Install Guides

Installing R

R is installed from a central repository named CRAN. Most users typically navigate to CRAN via www.r-project.org, although you can also navigate directly to CRAN.

  1. Click the “download R” link on the R Project main page.
  2. Choose the most local CRAN mirror. Each mirror is exactly the same, so it does not actually matter which one you choose, although it helps reduce traffic if you choose a local mirror.
  3. From the main home page of CRAN, there are three options, depending on your operating system. Click the appropriate link.

Installing R on Windows

The following steps describe the process of installing R on Windows:

  1. There are three available “subdirectories.” Click the link to “base.”
  2. At the top of the page the most recent R release on Windows is available for download via a link—for example, “Download R 3.2.3 for Windows.” Click the link to download the installer to a temporary location (or choose “run” if presented with the option). Once the download has completed, run the .exe file.
  3. If you are asked whether you wish to run or save the .exe file, choose run.
  4. Once the file has downloaded, run the .exe file.
  5. Choose your language and follow the instructions in the wizard.
    1. When presented with the option to configure startup options, as shown below, it is advised that you select No (accept defaults).
    2. Keep clicking Next through all the options, assuming you are happy with what the wizard is going to do.
    3. When you are ready, click the Finish button.

Installing R on Mac OS X

Carefully read the notes at the top of the page before downloading R on OS X.

The first link under the Files heading contains a link to the most recent version of R available on OS X—for example, R-3.2.3.pkg. Select this link and run the installer.

  1. Once the file has downloaded, run the .pkg file.
  2. Choose your language and follow the instructions in the wizard.
  3. Keep clicking Next through all the options, assuming you are happy with what the wizard is going to do.
  4. When you are ready, click the Finish button.

Installing R on Linux

Choose the appropriate link for your Linux distribution. Each distribution contains its own instructions and/or README file for installing R. For Debian and Ubuntu, the latest stable version of R is available in official repositories. Detailed instructions for downloading and installing R are provided on the home page.

Installing the RStudio IDE

RStudio is installed from RStudio’s own website, www.rstudio.com. Please be aware that these instructions may change as RStudio changes it's website. Specifically, buttons may be moved or their names changed.

  1. The RStudio home page has traditionally contained one or more obvious links in order install the RStudio IDE. The IDE is currently available via a link that states “Powerful IDE for R.” Select the link to take you to the RStudio IDE download page.
  2. You are presented with the option of installing the Desktop or Server version of the IDE. Select the “Desktop” link

  3. The “Desktop” link takes you to the appropriate section of the page, where you are presented with the option to download the Open Source edition or the Commercial License version. Assuming you do not wish to purchase the commercial version at this time, click the DOWNLOAD RSTUDIO DESKTOP button.
  4. Clicking the DOWNLOAD RSTUDIO DESKTOP button takes you to a page with a number of links to installers for the open-source version of RStudio Desktop. Scroll down through the page until you see an installer that is appropriate for your operating system (for example, RStudio 0.99.491 – Windows Vista/7/8/10). Click the link to download the installer.
  5. Run the installer. If you are on Mac OS X, you are presented with an install wizard:
    1. Navigate through the wizard, clicking Next to accept the default options.
    2. When you are ready, click the Finish button to install RStudio.

Mac: Installing XCode

Additional command line tools required for Mac when building R packages can be obtained in one of two ways. Command Line Tools for Xcode

This is the smallest download and is available to anyone who is registered as an Apple Developer.

https://developer.apple.com/downloads/

Ensure that you download the correct version for your version of OS X.

XCode

This is available to all Mac users for free through the AppStore. After installing you will need to then download and install "Command Line Tools" from Preferences.

However you choose to install these tools you can test that your system is correctly set up by loading the devtools package and running has_devel. The has_devel function will check that the development environment is correctly set-up. It will return TRUE if your system is correctly set-up.

Windows: Installing Rtools

Building packages requires a number of additional command line tools that are not available on Windows. We can access them by installing Rtools, a set of development utilities available on CRAN.

  1. Navigate to the Rtools pages on CRAN. Note that this is not an R package but a set of additional utilities.

  2. Ensure that you install the correct version of Rtools for the version of R that you are using. The site will list all of the versions available and the corresponding R version in a table as follows:


    As an example of which version to download, if you are using R 3.1.2 you will need to install Rtools31.

  3. During the install process you will be asked if you want to update your system path. This is important to be able to build packages, if you choose not to let the install process handle this you will need to add it manually.


  4. You can ensure that the set-up is correct by launching devtools and running has_devel. When loading devtools it will ensure that Rtools can be found on the system path. The has_devel function will then check that the development environment is correctly set-up. It will return TRUE if your system is correctly set- up.

    > library(devtools)
    Warning message:
    package ‘devtools’ was built under R version 3.1.3
    > has_devel()
    "C:/PROGRA~1/R/R-31~1.2/bin/i386/R" --no-site-file --no- environ --no-save \
    	--no-restore CMD SHLIB foo.c
    
    gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG - I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall -std=gnu99 -mtune=core2 -c foo.c -o foo.o
    gcc -m32 -shared -s -static-libgcc -o foo.dll tmp.def foo.o - Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386 - Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R- 31~1.2/bin/i386 -lR
    [1] TRUE