How to Install R on Linux Ubuntu 16.04 Xenial Xerus

April 26, 2016
By

(This article was first published on R Tricks – Data Science Riot!, and kindly contributed to R-bloggers)

The long-awaited new Ubuntu LTS Xenial Xerus was released last week. I wrote a tutorial on installing R and R-Studio on the old 14.04 LTS, so I figured I’d update that document. Not much has changed for the new 16.04 version but there are new repositories.

Install R-Base

You can find R-Base in the Software Center; this would be the easy way to do it. However, the Software Center versions are often out of date, which can be a pain moving foward when your packages are based on the most current version of R Base. The easy fix is to download and install R Base directly from the Cran servers.

1. Add R repository

First, we’ve got to add a line to our /etc/apt/sources.list file. This can be accomplished with the following. Note the “xenial” in the line, indicating Ubuntu 16.04. If you have a different version, just change that.

sudo echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list

2. Add R to Ubuntu Keyring

First:

 gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9

Then:

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

3. Install R-Base

Most Linux users should be familiar with the old…

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

Installing R-Studio

From here you can download your files and install the IDE through Ubuntu Software Center or Synaptic Package Manager, or since you’ve already got the terminal open, you could just:

sudo apt-get install gdebi-core
wget https://download1.rstudio.org/rstudio-0.99.896-amd64.deb
sudo gdebi -n rstudio-0.99.896-amd64.deb
rm rstudio-0.99.896-amd64.deb

rstudio16

To leave a comment for the author, please follow the link and comment on their blog: R Tricks – Data Science Riot!.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)