How to update R from 3.x to 4.x and should I?

Viewed 3076

With R 4.0.0 and recently R 4.0.1 being released recently, I would like to know how to upgrade?

Previously I used UpdateR() from the installR package.

Will it work just as well upgrading to 4.x?

The documentation for 4.0.0 states that:

Packages need to be (re-)installed under this version (4.0.0) of R

Will updateR re-install everything and if not, how can I get list of packages to install in a reasonable amount of time.

I cannot believe I can't find any 4.x install or update details elsewhere, most importantly are there any specific issues or limitation or code changes required in 4.x from 3.x.

Also I use Rbuild Tools for Rcpp. Do I need to update those tools to 4.0 as well and is there a special way to do so?

2 Answers

I did this a few weeks ago.
UpdateR didn't migrate the packages as expected, so that I had to do it manually :

  • Install R 4.0.x
  • Install RTools 4.0, take care to set $Path correctly as instructed. This new version is necessary for R 4.0 to compile from source some packages still in 3.x
  • Migrate the packages from R 3.x to R 4.x :
# locate packages
.libPaths()
[1] "/Documents/R/win-library/4.0" 
# Migration list : replace previous 4.0 by 3.x in old_lib_loc
old_lib_loc <- "/Documents/R/win-library/3.x"
to_install <- unname(installed.packages(lib.loc = old_lib_loc)[, "Package"])
# Check if list is OK or if you want to clean up
to_install
[1] "abind"                "acepack"              "ada"                  "alphavantager"                   
[6] "ash"                  "askpass"              "assertive"            "assertive.base"       "assertive.code"  
# Migrate
install.packages(pkgs = to_install,Ncpus = 4) 

Packages still in 3.x are automatically recompiled from source.
That's it, no problems encountered since then.

First, you should run: this will remove R

    $ sudo apt remove r-base

then type this, so you can add the GPG Key

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

Now add this repo

    $ sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'

then update your packages list

    $ sudo apt update

now install R

    $ sudo apt install r-base
Related