Showing posts with label R. Show all posts
Showing posts with label R. Show all posts

Friday, November 20, 2015

R : move selected column to the left

install.packages("dplyr")

library(dplyr)

# move Survived column to the left and keep everything else the same
train <- train2 %>% select(Survived, everything())

Friday, November 13, 2015

R : position in qplot

qplot(color,data=diamonds, fill=cut, position ="dodge")


"dodge" : Overlapping geoms are placed beside each other

"statck" : Overlapping geoms are placed one above the other

"identity" : No adjustment. Geoms are allowed to overlap

"fill" : The available space is divided proportionately between the overlapping geoms.

"jitter" : Random noise is added to the position of each geom

Thursday, November 5, 2015

R : install ggplot2 package on Windows 8

Install Rtools for Windows : https://cran.r-project.org/bin/windows/Rtools/

Without RTools, we cannot compile the package.

In the R console , run :

install.packages("ggplot2", type="source",dependencies = TRUE)

Wednesday, November 4, 2015

R : stringsAsFactors

https://www.zoology.ubc.ca/~schluter/R/data/

stringsAsFactors = FALSE tells R to keep character variables as they are rather than convert to factors

Sunday, August 31, 2014

Install RStudio

$ wget http://download1.rstudio.org/rstudio-0.98.1028-x86_64.rpm
--2014-08-31 13:36:56--  http://download1.rstudio.org/rstudio-0.98.1028-x86_64.rpm
Resolving download1.rstudio.org... 54.230.38.99, 54.230.38.175, 54.192.36.94, ...
Connecting to download1.rstudio.org|54.230.38.99|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 60750472 (58M) [application/x-redhat-package-manager]
Saving to: “rstudio-0.98.1028-x86_64.rpm”

100%[======================================>] 60,750,472  2.20M/s   in 35s    

2014-08-31 13:37:36 (1.65 MB/s) - “rstudio-0.98.1028-x86_64.rpm” saved [60750472/60750472]

# rpm -Uvh rstudio-0.98.1028-x86_64.rpm
Preparing...                ########################################### [100%]
   1:rstudio                ########################################### [100%]


$ which rstudio
/usr/bin/rstudio

$ rstudio