Site icon R-bloggers

Installing R/RStudio on Ubuntu 14.04

[This article was first published on The R Trader » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

My last experience with Linux was back in 2002/2003. At that time pretty much everything on Linux was done in the console. I remmember struggling for days with a simple Wifi connection because drivers were not readily available. Things have changed dramatically since then. Last week I installed Linux (Ubuntu 14.04)  on an old Windows laptop. It took me about 20 mins to erase completely Windows, install Linux and start playing with R/Rstudio: simply amazing…. In this post I explain step by step what I did: bear in mind that I’m a Linux absolute beginner.

1 – Install Linux

2 – Install R

Ubuntu 14.04 ships with R but it’s not the latest version. The latest version can be obtained from CRAN. An entry like :  http://<my.favorite.cran.mirror>/bin/linux/ubuntu trusty/ has to be added to the /etc/apt/sources.list file, replacing <my.favorite.cran.mirror> by the actual URL of your favorite CRAN mirror (see http://cran.r-project.org/mirrors.html for the list of CRAN mirrors). Actually this is a bit  tricky because you need admin rights to modify the sources.list file. I used a small utility called gksudo to open and modify the sources.list file. In the command line type the following:

gksudo gedit /etc/apt/sources.list

This will open the sources.list file in gedit. You just need to add the repository above then save and close

You can then install the complete R system, by typing the following in the console:

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

There are other ways of doing this but adding an entry to the sources.list file is apparently the prefered option. Ubuntu uses apt for package management. Apt stores a list of repositories (software channels) in the sources.list file. By editing this file from the command line, software repositories can be added or removed.

3 – Install RStudio

if you want to have RStudio icon on the launcher (all the icons on the left hand side of the screen)

All this might not be perfect but it worked for me without a glitch. I wanted to share my experience because  I’m trully amazed by the improvements brought to Linux over the last few years.

As usual any comments welcome.

To leave a comment for the author, please follow the link and comment on their blog: The R Trader » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.