There are three steps to get you running:

  1. Install R for your computer operating system
  2. Install RStudio
  3. Install my recommended extra R packages

Installing R

(These notes were modified from the R Workshop,

R is available for free for Windows, GNU/Linux and MacOS.
My current version is 3.4.4.

R is easiest to use with Rstudio as the graphical user interface. You should also install RStudio, as described below.


Visit the download page and choose the corresponding installer for your platform. After downloading, double-click on the installer file. Usualy, that is **all* you need to do.

Power users only

You will need Rtools to compile and install some packages, but this is an advanced feature you may not require. Mainly useful when you want to install packages from their source code or bleeding-edge versions from github.

There is no general software/package manager in Windows, but you can install the R library installr. This package provides the updateR() function which takes care of updating your R installation and migrates your installed libraries whenever a major R update is released. Recently, a package has been released which can also help you in this task.


You can either browse to the download page or better use the Homebrew package manager.

Robert Rudis wrote a nice blog post about a 100% homebrew r install.

Once homebrew is installed, you can easily install/uninstall many programs with their dependencies and utilities. This requires using the terminal, but is a generally useful skill to learn for MacOS.

To install R using brew type the following in a terminal window:

brew install r

Updates for all your software can be easily performed and will be automatically handled by the following line:

brew update; brew upgrade


All Linux distributions are bundled with a great package manager such as dpkg or rpm. Visit the appropriate webpage for your distribution here.

After you get the correct entry in your package manager, it should quite easy:

sudo apt-get install r-base r-base-dev

Other packages can be installed within Rstudio or the R console.

Install Rstudio

Rstudio is an Integrated Development Editor. It provides a convienent GUI for R that goes well beyond the standard R console. You need to install R first, because Rstudio needs to find your R version. The free-version contains everything you need.

Visit the download page and choose the corresponding installer for your platform. Currently, the latest version is 1.1.456.

See the blog entry about this major release.

Of note, version 1 introduced new features, such as inline code results to get chunks and execution one after the other.

Open RStudio

They are 4 main panels in rstudio, but as the top-left is for scripting and by default missing, the layout should looks like

Install R packages from the Comprensive R Archive Network (CRAN)

For this course, I have a recommended collection of packages. You can install them all by entering the following line in the Console panel. This will take a while. Go have a coffee.


Manual installation

On the bottom-right panel, 5 tabs are present:

  • Files
  • Plots
  • Packages
  • Help
  • Viewer

Click on the Packages tab (1.) and select the select the Install button (2.). Type devtools in (3.)

Of note, devtools is handy when you want to install a development version, for example if a bug was fixed but the package not yet submitted to CRAN.


Package updates

R packages are frequently updated. If you want to keep your R up to date, just use update.packages():


You could also use the green Update button next to the Install (located in the Packages tab). The advantage is that you can check which package you would like to update and look at the actual changes by clicking on the NEWS link.

Testing your installation

Copy / paste the code below into the Console, and you should obtain your first R plot.

plot(mpg ~ wt, data=mtcars)

If not, please contact me with the error produced and the output of

## R version 3.4.4 (2018-03-15)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 7 x64 (build 7601) Service Pack 1
## Matrix products: default
## locale:
## [1] LC_COLLATE=English_United States.1252 
## [2] LC_CTYPE=English_United States.1252   
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C                          
## [5] LC_TIME=English_United States.1252    
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## loaded via a namespace (and not attached):
##  [1] compiler_3.4.4  backports_1.1.2 magrittr_1.5    rprojroot_1.3-2
##  [5] tools_3.4.4     htmltools_0.3.6 yaml_2.2.0      Rcpp_0.12.18   
##  [9] stringi_1.2.4   rmarkdown_1.10  knitr_1.20      stringr_1.3.1  
## [13] digest_0.6.17   evaluate_0.11