Setup R and RStudio

You will need to download R and RStudio. It will be best if you install these two libraries prior to the workshop. Feel free to email me ( if you run into any trouble during the installation process. I’ll be happy to help out prior to the workshop.

R is the statistics engine. RStudio is a great graphical user interface for using R, writing code in R, producing reports (such as this one, as you will see during the workshop), maintaining version control of code you write, facilitating collaboration with others in a lab, etc.

For a printable version of the directions, click here. 

Download R

Go to R download site and select CRAN. Follow the instructions to select a server and operating system (Mac/Linux/Windows). If you already have R installed on your machine make sure you have version 3.0 or later, though might as well get the most recent copy so we are all on the same page. Upgrade accordingly if you already have R installed on your laptop.

Download RStudio

Go to RStduio download site and select “Download RStudio.” Follow the instructions for downloading. If you already have RStudio installed on your machine make sure you have version 0.98.945 (released June 2014) or later; if there is a more recent version available online it is fine to download the newest version. We will be making use of features added in the June 2014 release. Upgrade accordingly if you already have RStudio installed on your laptop.


During the workshop we will be downloading additional libraries. It is fine if you want to download some of these libraries prior to the workshop. Three we will definitely use are MASS, ggplot2, and lme4.

To install a library through the RStudio interface, go to the Packages tab (by default, the lower right window has 5 tabs, with Package being the 3rd). Click on the install icon. A dialogue box will appear. At the Packages field enter: MASS, ggplot2, lme4 (each term separated by a comma) For a picture of the the dialogue box, click here. 

The “install dependencies” box should be checked. Then click install and RStudio will proceed with the installation.

An alternative approach to installing libraries is to type the command install.packages() as in

install.packages(c(“MASS”, “ggplot2”, “lme4”), dependencies=TRUE)

We’ll go over installation of packages during the workshop. If you have any trouble installing these three libraries feel free to contact me prior to the workshop.

Additional Resources

My hope is to make this tutorial self-contained. Of course, there are many useful resources on the web to learn R. A few of my favorites:

  1. UCLA R Tuturials
  2. Coursera