2

I'm using renv i.e. for package management in R-projects. I cannot load packages from external sources. After a new R-Version was installed, I want to continue using the same packages in the new version as used in the old R-version.

Since renv creates a new directory to store packages for the new R-version (e.g. .../renv/library/R-4.2/), which contains only "base" packages installed with the new R-version, I want to "clone" the packages stored in the renv environment of the old R-version (e.g. .../renv/library/R-4.1/).

What is the best practice to simply use the same packages in the new R-version compared to the old R-version (without installing packages). Using renv::restore(), renv tries to newly install packages for the new R-version (and I don't want this). Can I simply "copy" the content of .../renv/library/R-4.1/ to .../renv/library/R-4.2/? Does renv provide options to simply keep using packages from "old R-versions" (here R-4.1) in "new R-versions" (here R-4.2)?

Peter
  • 2,120
  • 2
  • 19
  • 33
  • 2
    Some package are compiled and expect certain R APIs to be available. It's generally not a safe idea so just copy over packages build for different versions of R. You should be able to reinstall the same package version number in each version of R (if minimum R version requirements are met) but those will need to be in two separate libraries on disk. – MrFlick Jan 13 '23 at 14:50

0 Answers0