Installing R

From CAC Documentation wiki
Jump to: navigation, search

It is generally best to install R from CRAN rather than your distribution's repositories, due to R covering fields of science that develop quickly. In Ubuntu, this can still be done using apt. See http://cran.r-project.org/bin/linux/ubuntu/ for up-to-date information.

First install the CRAN key for apt:

 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9


Now create a new repo entry for CRAN by creating a file in /etc/apt/sources.list.d. The name of the file doesn't matter, but here is a reasonable suggestion:

 /etc/apt/sources.list.d/CRAN.list 

Edit the file and add the appropriate line for your CRAN mirror of choice and your Ubuntu version, e.g.:

 deb http://cran.r-project.org/bin/linux/ubuntu trusty/

Run sudo apt-get update in order to update the local package database (redhat: yum update; note that this will also attempt to upgrade all packages with available updates).

Install R: sudo apt-get install r-base r-base-dev

Done.