Ubuntu – R 3.5.0 for Ubuntu

16.04rsoftware installation

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?

Best Answer

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