options(repos = c(CRAN = "https://cran.rstudio.com"))
ip <- installed.packages()
pkgs <- ip[!ip[, "Priority"] %in% c("base", "recommended"), "Package"]
saveRDS(pkgs, "~/r-packages-before-update.rds")10 Update R - Bare Bones
10.1 Bare bones updater for R.
An annoying feature of R is that updating the R version doesn’t always (if ever) pull all of your installed packages in to the new version.
Updater packages for R are also a bit hit and miss.
The updateR package is quite popular, but I haven’t had much luck with it.
It is here if you want to try it…
devtools::install_github(“AndreaCirilloAC/updateR”)
My approach is very simple. Save a list of installed (i.e. non core packages), then manually update using R’s install packages, then read the list of installed packages back in and install them.
10.2 Update R
10.3 Save list of libraries to system
Then go to R’s install page and install the newest version
10.4 Restore libraries
options(repos = c(CRAN = "https://cran.rstudio.com"))
pkgs <- readRDS("~/r-packages-before-update.rds")
already_installed <- installed.packages()[, "Package"]
to_install <- setdiff(pkgs, already_installed)
install.packages(to_install)
update.packages(ask = FALSE, checkBuilt = TRUE)
The downloaded binary packages are in
/var/folders/kp/gr75h12s2gn3lbt3mcscb59r0000gp/T//Rtmp0PoTLS/downloaded_packages