Installing R and Rstudio
Here are step by step instructions for installing R and Rstudio. R is a useful and free application for data analytics that is widely used by statisticians and data miners. RStudio provides a more user friendly interface that will speed up your learning greatly!
Download and install R “3.0.3 pkg” here: Mac Install
Download and install R here: Windows Install
Download and install R here: Linux Install
Next, choose the appropriate package for RStudio here: RStudio Install
Setting Your Working Directory
Your working directory is the folder which you are directing R to extract and save files. First create a folder called “Leada” on your desktop.
Now in RStudio, we must create a file for us to write in. Go to File ==> New ==> Rscript. In this Rscript we must tell R where our current working directory is. We do this by using the
setwd() function. Your working directory indicates to R which folder to look for the datasets you want to use. Remember everything in R you type is case sensitive!
For Mac Users:
If your confused you can use the image below as an example, the correct code would be:
Running you RCode
To run what you just wrote in your RScript, put your cursor on a line of code in your RScript and enter
return at the same time! It should now pop up on the bottom left window labeled Console in blue, and if there is no red code that follows it has run correctly. Congrats you’ve just run your first line of R code! From now on you can run any of our code snippets by copy and pasting it into your own RScript, and entering
return on any part of the line runs the entire line of RCode.