How to install R 3.5.1 on Ubuntu 16 with apt-get?

2

1

I installed R on Ubuntu 16 using the command

sudo apt-get install r-base

However, the version of R installed is 3.2.3, which is quite old now. I was wondering if there is a way to tune apt-get to install the latest version of R?

Thanks a lot

Jerry Fan

Posted 2019-01-21T17:08:30.490

Reputation: 25

Answers

3

UPDATE:

The R-package can be installed from the r-cloud project repo. The version of R in the Ubuntu repo for Ubuntu 18 will only give you 3.4.4 which doesn't matter because you don't want to use that one anyway due to potential dependency conflicts.

You'll need to do the following to add the r-cloud project repo to /etc/apt/sources.list:

sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9

sudo apt update

sudo apt install r-base r-base-core r-recommended

That will actually install R/3.5.2.

If you specifically need R/3.5.1, you will need to build it from source and add the executables and libraries to your PATH and LD_LIBRARY_PATH. You can get the source code here: https://cran.r-project.org/src/base/R-3/

The first way is quicker and easier but the second way will be needed if you need that particular version of R.

Nasir Riley

Posted 2019-01-21T17:08:30.490

Reputation: 886

1

If you are using Ubuntu 16.04 This works for me installing R 3.6.1 (the default after adding the current repository)

sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo apt update
sudo apt install r-base-dev

Not sure why I can't install r-base and r-recommended though. For more info if you are using other Ubuntu version, check out the README on r-project.org here

Bhoom Suktitipat

Posted 2019-01-21T17:08:30.490

Reputation: 111