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



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.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.