Suppose I have R version 3.x.x installed, and I upgrade to version 4.x.x, is there any quick/easy way to install all the new versions of the libraries I had installed?
Please assume all the packages are on CRAN
Don't know if this is quick and easy, but I think the pacman
package can be useful.
pacman::p_lib()
to return a vector of your installed packages, and save them onto disk use saveRDS()
.For instance,
mypks <- pacman::p_lib()
saveRDS(mypks, "~/mypks.rds")
Update R.
Import the vector from step 1 using readRDS()
and run install.packages()
with the object.
For instance,
mypks <- readRDS("~/mypks.rds")
install.packages(mypks)