Ubuntu – Installing latest version of R-base

aptrsoftware installation

I have been unsuccessfully trying to install the latest version (2.15.2) of r-base. Apparently, R package Rcpp would not install for R version 2.14.1 – the version that installs for me.

I am not sure what/how/where to change my installation attempts which appear below. Please note that I am using ubuntu-12.04.1-server-i386.

The current installed version is R version 2.14.1 (2011-12-22):

$ sudo apt-get install r-base
Reading package lists... Done
Building dependency tree       
Reading state information... Done
r-base is already the newest version.

Including version information doesn't help:

$ sudo apt-get install r-base=2.15.1-5ubuntu1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '2.15.1-5ubuntu1' for 'r-base' was not found

Changes based on CRAN Ubuntu instructions from http://cran.r-project.org/bin/linux/ubuntu/README:

  1. Added to /etc/apt/sources.list

    deb http://lib.stat.cmu.edu/R/CRAN/bin/linux/ubuntu quantal/
    
  2. Update and install

    $ sudo apt-get update
    $ sudo apt-get install r-base
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     r-base : Depends: r-base-core (>= 2.15.2-1quantal2) but it is not going to be installed
              Depends: r-recommended (= 2.15.2-1quantal2) 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.
    

Best Answer

None of the above worked for me so I am copying the answer from https://stackoverflow.com/questions/16093331/how-to-install-r-version-3-0

Uninstall old R:

sudo apt-get remove r-base-core

Then:

sudo add-apt-repository "deb http://cran.rstudio.com/bin/linux/ubuntu $(lsb_release -sc)/"

Then copy/paste these commands into the command line:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository ppa:marutter/rdev
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install r-base

Which worked for me