Philipp Burckhardt

On Statistics, Programming and the Social Sciences

Installing R & RStudio on Ubuntu

In this post, I will go through the steps of installing R and the RStudio IDE on the Ubuntu operating system. There are many institutions hosting mirrors with the current versions of R, one of which we have to add to the sources.list file as the versions which come with Ubuntu itself are often very out-dated. Opening this file with the command

sudo pico /etc/apt/sources.list

we can add the following line at the end if we are using the current Ubuntu distribution Trusty Tahr (14.04):

deb http://cran.rstudio.com/bin/linux/ubuntu trusty/

Having done this, we are able to install R via the commands

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

In case of receiving the error message

W: GPG error: http://cran.rstudio.com trusty/ Release: The following signatures couldn't be verified because the public key is not available

we should add the respective public key as follows:

gpg --keyserver pgpkeys.mit.edu --recv-key 51716619E084DAB9
gpg -a --export 51716619E084DAB9 | sudo apt-key add 

With R installed, RStudio can simply be downloaded from
https://www.rstudio.com/ide/download/desktop
as an \*.deb file, which can then be installed by opening it in the Ubuntu Software Center.