minie
minie

Reputation: 111

Install R latest verison on ubuntu 16.04

So I tried to install R (after repairing ubuntu on my system) using following command :

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

It installs R 3.2 , but the latest version of R currently available to use is R 3.4, any idea why it is not installing R 3.4 ?

I lately installed R.3.4 manually, it works fine. just curious to know why it didn't installed at the first place using the command.

Upvotes: 11

Views: 19109

Answers (3)

Scott
Scott

Reputation: 1042

The xenial-cran35/ version of the repo does NOT work if you have a "default release" set in apt, as is the case in some distros that work on top of Ubuntu, such as Mint. For my Mint distro, there exists a file /etc/apt/apt.conf.d/01ubuntu inside of which it declares the Default-Release "xenial"; What this means is that, since r-base exists in the ubuntu repo at version 3.2, with release "xenial", it'll never use the 3.6 branch from the other repo, because the release name for that repo is "xenial-cran35". You need to edit that file to change the default release to "xenail-cran35", or do something more pointed using apt preference files (https://wiki.debian.org/AptPreferences#A.2Fetc.2Fapt.2Fpreferences).

This is basically R's fault for having a poorly formatted repo. They should have had 2 repos, each of which had a "xenial" release folder, one url for their 3.2 branch work and one for the 3.5+ branch work. Instead they have one repo, and have bastardized the "release name" instead, which just sort of happens to work for base Ubuntu, but won't work if you have non-base configuration of apt in this way.

Upvotes: 0

NickZeng
NickZeng

Reputation: 1250

Follow these steps:

  1. Add this entry deb https://cloud.r-project.org/bin/linux/ubuntu xenial/ to your /etc/apt/sources.list file.

  2. Run this command in shell: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9.

  3. Update and install: sudo apt update; sudo apt install r-base.

I wrote a post that explains each step in detail (update: also covers installing R on Ubuntu 18.04); here's the link.

Upvotes: 17

Dason
Dason

Reputation: 61933

It installs 3.2 because that's the default in the Ubuntu 16.04 repository. If you want the most up to date version of R for Ubuntu it's best to follow the instructions at the cran page for R on Ubuntu.

Upvotes: 11

Related Questions