How to Install R in Linux Ubuntu 14.04

The R programming language is one of the most powerful tools for data analysis on any operating system. There are two major parts of each install, the R-base that installs the programming language and its dependencies and R-Studio, which is an open-source IDE for R.

If you need help on installing R on Ubuntu 16.04 LTS, you can find that here.

Installing these in Windows is a snap but for Linux distros such as Ubuntu and Mint, they require a little command line finesse.

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 “trusty” in the line, indicating Ubuntu 14.04. If you have a different version, just change that.

sudo echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" | 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

Download the appropriate version of R-Studio here. From here you can download your files and install the IDE through Ubuntu Software Center or Synaptic Package Manager.

If you prefer a command line approach to install Rstudio:

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

Screenshot_R

11 thoughts on “How to Install R in Linux Ubuntu 14.04

  1. If you get the following error while installing r-base in Ubuntu:

    The following packages have unmet dependencies:
    r-base : Depends: r-base-core (>= 3.2.1-4vivid0) but it is not going
    to be installed
    Depends: r-recommended (= 3.2.1-4vivid0) but it is not going to be installed
    Recommends: r-base-html but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

    just add “deb http://cran.cnr.Berkeley.edu/bin/linux/ubuntu trusty/” in the source list (/etc/apt/sources.list).

  2. if you get error while running RStudio,
    suggest you
    1. uninstall R
    1-1 sudo apt-get remove r-base
    1-2 sudo apt-get remove r-base-core
    2. sudo apt-get update
    3. sudo apt-get install r-base
    4. download R-Studio *.deb file, then install
    sudo dpkg -i rstudio-xxxxx-amd64.deb
    Then it will work well. Enjoy it!

  3. On Ubutu 14.04, I got error:
    Errors were encountered while processing:
    rstudio

    I found that here are some unment dependencies which haven’t get downloaded. What i did is i run
    `sudo apt-get -f install`
    When that command completed i again run
    `sudo dpkg -i *-amd64.deb`.
    And now RStudio is running as charm.

Leave a Reply