1

I am using Ubuntu 16.04. I want to install R (latest version) on it. As the system version is older, it can't find this version from terminal line. I checked it with this command on the terminal line.

sudo apt-get install r-base=3.6.1

Which resulted in -

Version '3.6.1' for 'r-base' was not found

I want to install this version with all it's packages. What is the correct process? Can I get all the package files and installation files to install all of it in one go from my terminal? Please suggest me an appropriate way of achieving this.

1 Answer 1

1

To install R 3.6 (3.6.1 specifically) on Ubuntu 16.04, you need to add the r-cloud project repo to /etc/apt/sources.list file.
To do that, run the following commands:

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

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

sudo apt update

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

If you want to install another version, you need to build it from source then add the executables and libraries to your PATH and LD_LIBRARY_PATH. You can get the source code from here.

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


Edit: I am not sure how packages are managed in R. But I think that essential packages will be installed with R and if you want a specific package you need to install it using R package manager.
To install a package named 'foo' for example, run sudo -i R to open the R console then run install.packages("foo").
For more details about which packages are installed and how to install additional packages check the R README page

8
  • Will this install all packages?
    – Niranjan
    Dec 6, 2019 at 15:20
  • Yes, it should install all essential packages. Try it, if you encounter any error, comment it here and we'll try to fix it.
    – singrium
    Dec 6, 2019 at 15:29
  • Ok, does "essential packages" imply that there are some uninstalled (inessential) packages? I literally want "all" the packages.
    – Niranjan
    Dec 6, 2019 at 15:30
  • I don't know how packages are managed in R. But I think that essential packages will be installed and if you want some specific package you need to install it using R package manager (this is how it works in Python for example). Check the R documentation for more details about which packages are installed and how to install additional packages
    – singrium
    Dec 6, 2019 at 15:40
  • Ok. Thank you for your assistance.
    – Niranjan
    Dec 6, 2019 at 16:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .