Data Analysis / projects / Statistics & Data Science

Installing R on ElementaryOS

A quick note for future reference. Today I spun up a virtual machine with a new (to me) linux distro, ElementaryOS. Being an ubuntu derivative, I had thought getting ElementaryOS up and running would be straight forward, but I have spent the last couple of hours troubleshooting the installation of R. Here are the keys issues / fixes for future reference.

Attempt 1: Install R from Ubuntu repositories


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


This works nice and simple. However, had issues installing packages. There were a number of issues, mostly related to dependencies, but the core issue here was that when trying to install devtools I was getting an unmet dependency on xml2. This should have been there, having installed libxml2-dev from the ubuntu repositories. Was also getting a catch-all “plyr package is not available for R 3.0.1” when trying to install plyr.

The Problem:

As always, there are a myriad of forums all offering different solutions. Trying to install dependencies did not work for me.

Finally hit upon a stackoverflow answer ( that worked for me. Simply seems that the ubuntu repositories point to R version 3.0.2 by default, and this is horribly out of date.

The Fix:

The Fix it seems is simple – install R version 3.2.0.

I added the Auckland CRAN mirror to the sources.list, ran an update and then reinstalled R 3.2.0. devtools and plyr then installed without issue. Many thanks to the people on stackoverflow!

Useful links: (adding the public key for the Auckland CRAN mirror)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s