renv: set library path before calling renv::init

145 Views Asked by At

I am trying to use renv on windows 10 to keep track of packages in one R (4.2.1) project. There are 2 paths in the .libPaths() output. When I run renv::init() the full set of packages in .libPaths() folders is loaded, even though only one package is explicitly used in the project. This takes hours to run.

So, I want to configure the library path to avoid the folder with extra packages and keep only the basic R library, i.e., "C:/Program Files/R/R-4.2.1/library". Any missing project libraries will be installed with renv::install().

I have tried these:

  1. in R run: options(renv.config.hydrate.libpaths = "C:/Program Files/R/R-4.2.1/library")
  2. in R run: Sys.setenv(RENV_CONFIG_HYDRATE_LIBPATHS = "C:/Program Files/R/R-4.2.1/library")
  3. in a file called .Renviron inside the project folder set: RENV_CONFIG_HYDRATE_LIBPATHS = "C:/Program Files/R/R-4.2.1/library"

All above are ignored, as all the extra libraries are being downloaded anyways. I have tested deleting the contents of the extra .libPaths() folder and the process is fast and no extra libraries are loaded. So, I am confident the instructions above are not being set correctly. Any ideas on what might be wrong here?

0

There are 0 best solutions below