After update to R 4.1
# update indices
sudo apt update -qq
# install two helper packages we need
sudo apt install --no-install-recommends software-properties-common dirmngr
# import the signing key (by Michael Rutter) for these repo
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
# add the R 4.0 repo from CRAN -- adjust 'focal' to 'groovy' or 'bionic' as needed
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
Here we use lsb_release -cs to access which Ubuntu flavor you run: one of “hirsuite”, “groovy”, “focal”, “bionic”, …
Then run
sudo apt install --no-install-recommends r-base
See: https://cran.r-project.org/bin/linux/ubuntu/
pkgs <- as.data.frame(installed.packages(), stringsAsFactors = FALSE, row.names = FALSE)
pkgs[, c("Package", "Version", "Built")]
Will list the packages with their built version.
Then you can do:
update.packages(ask = FALSE, checkBuilt = TRUE)
See: https://shiny.rstudio.com/articles/upgrade-R.html
You can also remove duplicated packages:
library("HelpersMG")
li <- duplicated_packages()
if (nrow(li) != 0)
for (i in 1:nrow(li))
remove.packages(rownames(li)[i], lib=li[i, "Lib1"])
Commentaires
Enregistrer un commentaire