R 3.5.0 installation packages for Ubuntu Xenial (16.04) do not yet exist on the ubuntu mirror sites. Is there an alternative method for updating R to 3.5.0 on ubuntu xenial? Alternatively, is there a different method to update R to 3.5.0?


R 3.5 are currently only available from a PPA, because some of CRAN's packages have problems building with R 3.5.

Proceed at your own risk.

The procedure that worked for me is:

  1. Remove all r-cran-* packages from your system (YMMV, I'm usually installing packages from source and have very few of these)

    • Search with dpkg -l | grep r-cran-
  2. Add Michael Rutter's PPA:

    sudo add-apt-repository ppa:marutter/rrutter3.5
    sudo apt-get update
    
  3. Upgrade R

    sudo apt install r-api-3.5
    
  4. Install all packages you need from source (to a personal or site library via install.packages()) or by installing the corresponding r-cran-* Ubuntu package.

    I use the following script to reinstall all packages my packages from my personal site library for R 3.4:

    installed <- rownames(installed.packages())
    pkgs <- dir("~/R/x86_64-pc-linux-gnu-library/3.4")
    new <- setdiff(pkgs, installed)
    new
    install.packages(new)
    

    If you have a machine with multiple CPUs, you can speed up the process, for example:

    install.packages(new, Ncpus = 6)
    

References

  • Reply by Dirk Eddelbuettel to a similar inquiry on the R-SIG-Debian mailing list

  • Related SO question


The CRAN site has been updated since's @krlmlr's response in early June: https://cran.r-project.org/bin/linux/ubuntu/.

The CRAN instructions have several steps, but the summary is that the sources.list file should reference a repository that's specific to version 3.5.x & 3.6.x. The entry is something like

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

instead of the previous (versionless) entry of

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

The relevant description from the website (which will eventually change):

R 3.6 packages for Ubuntu on i386 and amd64 are available for most stable Desktop releases of Ubuntu until their official end of life date. However, only the latest Long Term Support (LTS) release is fully supported. As of November 18, 2018 the supported releases are Xenial Xerus (16.04; LTS), Trusty Tahr (14.04; LTS), Bionic Beaver (18.04;LTS), Cosmic Cuttlefish (18.10), and Disco Dingo (19.04). Note, to install R 3.6 packages, a different sources.list entry is needed. See below for details. Even though R has moved to version 3.6, for compatibility the sources.list entry still uses the cran3.5 designation.


edit 2019-05-13: update for last month's release of R 3.6.0.


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.