Installing R

R is a cross-platform statistical computing package that runs in the command line. There are various interfaces that run and display R in a more user-friendly format. These are installed separately from R. One of the most popular and polished interfaces is called R studio, and it also happens to be cross-platform.

In this workshop, we will be using the latest version of R-project together with the RStudio interface. Feel free to try out different options and use what works best for you. Everything you learn in this workshop will be independent of the user interface you choose.

Below you can find the installation instructions for:

After you install R and R Studio, you should install the packages we’ll be using in the workshop. The packages are platform independent. Don’t worry, we’ll go over what packages are and how to find them during the workshop.

Windows

Installing R for Windows

  1. Navigate to https://cran.r-project.org/.
  2. If you are asked to choose a mirror, pick any one close to your location.
  3. Click “Download R for Windows”.
  4. Click “base”.
  5. Click “Download R [version number] for Windows”.
  6. Proceed through the installation (choose 64-bit if you have a computer with a 64-bit processor; most newer computers do).
  7. After installation, you will notice that R has appeared in your programs folder. This is a default interface for R in Windows. A better interface is R Studio.

Installing the RStudio Interface for Windows

  1. Navigate to https://www.rstudio.com/
  2. Click “RStudio” or navigate to “Products –> RStudio”
  3. Click “Desktop” to download the Desktop version.
  4. Choose the Windows Installer (selecting 32-bit/64-bit where appropriate)
  5. Proceed through the installation.
  6. RStudio should be able to find your default R installation.

Mac

Installing R for Mac

  1. Navigate to https://cran.r-project.org/.
  2. If you are asked to choose a mirror, pick any one close to your location.
  3. Click “Download R for (Mac) OS X”.
  4. Choose the appropriate package file for your version of Mac OS X.
  5. Proceed through the installation.
  6. After installation, you will notice that R has appeared in your programs folder. This is a default interface for R in OS X. A better interface is RStudio.

Installing the RStudio interface for Mac

  1. Navigate to https://www.rstudio.com/
  2. Click “RStudio” or navigate to “Products –> RStudio”
  3. Click “Desktop” to download the Desktop version.
  4. Choose the Mac OS X Installer, download, and run it
  5. Follow the install instructions

Linux

Installing R for Linux

For Debian-based versions of Linux (and perhaps others), R is typically included in your package manager. You should be able to install R with the following command (you probably need root privileges; e.g., sudo):

In case R is not included with your distribution, You may navigate to https://cran.r-project.org/, choose “Download R for Linux”, and choose the appropriate Linux distribution.

After R is installed, you can open R by opening a terminal and running R. A nice interface to use is RStudio.

Installing the RStudio interface for Linux

  1. Navigate to https://www.rstudio.com/
  2. Click “RStudio” or navigate to “Products –> RStudio”
  3. Click “Desktop” to download the Desktop version.
  4. Choose the Linux Installer appropriate for your version of Linux
  5. Open the program with your package manager, and install

Packages

It would be a good idea to install the following packages before the workshop begins.

Open Rstudio and run the following command.