Installing R and R Studio

R

Installing R is easy. Simply go to https://cloud.r-project.org/ and download the appropriate version of R depending on your operating system:

Linux
Click on Download R for Linux, pick a link based on your distribution (such as ubuntu/), and then follow the instructions specific to that distribution.
Windows
Click on Download R for Windows, then base, and finally Download R X.X.X for Windows.
Mac (OS) X
Click on Download R for (Mac) OS X, then under “Latest release” click on R-X.X.X.pkg.

R Studio

After you’re done installing R, it’s time to install R Studio. Simply go to https://rstudio.com/products/rstudio/download/#download and pick a suitable version for R Studio depending on your operating system. Download and install it.

Getting Started with R Studio

To proceed, open R Studio and do the following:

  1. Create a project (File -> New Project), name it dataviz, stae04, (or whatever you feel like), and save it to a folder somewhere on your hard drive. This will be where you store all your work on the course.
  2. Create a data folder in that project.
  3. Create an R script (Ctrl/CMD + Shift + N) and save it inside your project folder. (If you are moving through the course material in order, you may want to name it worked_example_r.R or something along those lines.)
  4. Play around with R by writing some commands in the Console. Try out some basic commands like 3 + 1 and mean(c(1, 3, 5)).
  5. Put some code into your R Script, such as the commands above, and try executing the code by highlighting the code and hitting Ctrl/CMD + Enter.

Settings

There are a lot of settings in R Studio. Most of the defaults are fine, but there is at least one setting we recommend that you alter straight away. Go to Tools -> Global Options and un-check “Restore .RData into workspace at startup” and select “never” for “Save workspace to .Rdata on exit”.