1 May, 2017
R and RStudio are two separate but connected things
R is like the engine of your carRStudio is the 'cabin' we use to interact with the engineRStudio even comes with extra flashy features not related to RR does all the calculations, manages the data, generates plotsRStudio helps manage our code, displays the plots plus moreRStudio
R Projects to manage code/data for each project/analysisDocuments/R-Training-20170501 in your home folderdatatoothData.csv intoDocuments/R-Training-20170501/dataRStudioFile > New Project > Existing Directory >
Documents/R-Training-20170501Create ProjectR Projects are simply a wrapper for keeping an analysis organisedR Project name will always be the directory nameR Console is the engine1 + 1
## [1] 2
2*2
## [1] 4
As well as performing simple calculations:
R has what we call an Environment (i.e. a Workspace)R performs calculations & runs processes on these objectsR objectTo create an R object:
nameOfObject <- data
<- symbol is like an arrowR to put the data in the objectR objectIn the Console type:
x <- 2 y <- 3
x and y
Environment TabGlobal EnvironmentR objectsx
## [1] 2
y
## [1] 3
R objectsx + y
## [1] 5
x / y
## [1] 0.6666667
R has a series of inbuilt functions, e.g. sqrt(), log(), max(), min() etc
() after the name of a functionsqrt(x)
## [1] 1.414214
log(x)
## [1] 0.6931472
base
R?base
Index at the bottom for a list of these