How you install R 3.2.2 in Ubuntu 14.04 LTS?

Solution 1:

I don't know of a "good/"easy" way to get an intermediate version of R (one between the Ubuntu repo version and the current one), but you have a few options:

  1. You will likely need to install dependencies anyway, so you could try installing from deb. If you only need the one version installed on your system, this may be the way to go. Install it using gdebi, which automatically resolves dependencies for you (first sudo apt-get install gdebi-core; then sudo gdebi packageName.deb).

  2. You can attempt to build from source, but that can be a pain. The upside is that you can have multiple versions of R installed this way by specifying a --prefix=/path/to/use in the ./configure step (see here).

    wget https://cran.rstudio.com/src/base/R-3/R-3.2.2.tar.gz
    tar xvf R-3.1.1.tar.gz
    cd R-3.2.2
    ./configure
    make && make install
    
  3. If you are familiar with Docker, you can get version-specific R images:

    docker pull r-base:3.2.2
    

    then

    docker run -it --rm r-base:3.2.2
    

Solution 2:

The solution for me was the following script to build R from source:

wget https://cran.rstudio.com/src/base/R-3/R-3.2.2.tar.gz
tar xvf R-3.2.2.tar.gz
cd R-3.2.2
sudo apt-get install gcc
sudo apt-get install fort77
sudo apt-get install aptitude
sudo aptitude install g++
sudo aptitude install xorg-dev
sudo aptitude install libreadline-dev
sudo aptitude install gfortran
gfortran --version
./configure
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
java -version
# need to build shared library (--enable-R-shlib)
sudo ./configure --enable-R-shlib      # the --enable-R-shlib option is needed for the RStudio IDE to work
sudo make
sudo make install
R --version