Installing R on Ubuntu

The statistical analysis and data mining package R is a frustratingly difficult piece of software to find help for in Google (it reminds me of trying to find this band on Napster back in the day).

Once I finally found it, the installation instructions for Ubuntu are less than direct. So, here’s how I installed R on Ubuntu 12.04.

Firstly get the repository SSL key and import it in to apt.

gpg --keyserver --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -

Next edit your sources list…

gksudo gedit /etc/apt/sources.list

…and add the repository to the bottom. Other sources are available.

deb precise/

Then install R.

sudo apt-get update
sudo apt-get install r-base

Now you can get an R prompt with.


Or create a shell script with a shebang.

print("shebang works")