Reinstalling packages on new version of R

Important: don't do this on a production machine

You ask several questions, and I paraphrase:

What is the danger of copy-pasting packages to a new library location?

For individual work, the risk of doing this is quite low. As already mentioned, some packages will need recompilation due to the internal changes in R-3.5.0. This may lead to runtime errors - so this is the risk you take.

But one strategy is to copy-paste, then run

update.packages(ask = FALSE)

Your second question is:

How can I script the installation of all my packages?

Try something like this, where lib_loc points to the library of your previous release of R

lib_loc <- "C:/Users/apdev/Documents/R/win-library/3.3"
to_install <- unname(installed.packages(lib.loc = lib_loc)[, "Package"])
to_install
install.packages(pkgs = to_install)
12 Likes