I am unable to install latest version of R

6,075

First, remove the installed version of R using:

sudo apt purge r-base

You should also uninstall any other R packages that you may have installed.

As stated in the R installation guide, for 16.04 you need to add the repository deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ to /etc/apt/sources.list. There is a longer and a shorter way to do this.

Longer way: To add the repository open a terminal and run

sudo nano /etc/apt/sources.list

Copy and paste deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ at the end of the file (paste is Ctrl+Shift+V for nano).

Then add the public key for the repository running the following command:

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

Finally, update your system to enable the repository:

sudo apt update

Shorter way: You can add the repository, key and update as an one-line terminal command:

sudo bash -c 'echo "deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/" >> /etc/apt/sources.list' && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 && sudo apt update

Now you should be able to install R 3.6 by running:

sudo apt install r-base
Share:
6,075
user1120
Author by

user1120

Updated on September 18, 2022

Comments

  • user1120
    user1120 over 1 year

    I am trying to install the latest version of R into Ubuntu 16.04.

    But somehow it installs 3.4.4 even though latest version of R is 3.6.1. I have also read some articles that state "To obtain the latest R 3.6 packages, add an entry like":

    deb https://cloud.r-project.org/bin/linux/ubuntu disco-cran35/
    

    But still I don't understand what should I do with this link.