Andrew15
Andrew15

Reputation: 83

renv paths - empty libraries when sharing R project which uses renv package

I'm using the 'renv' R package in an RStudio project to control/lock the package versions used by my script. The libraries sit in the project directory under ... renv\library\R-4.1\x86_64-w64-mingw32. I'm using R version 4.1.3 and renv 0.15.5. When this directory is copied to a colleague's machine (using memory stick) the libraries in the directory mentioned above are blank. I'm assuming these libraries are just pointers to where R saves packages (e.g. "C:/Program Files/R/R-4.1.3/library") and my colleague doesn't have these packages on their machine.

Is there a way to include the packages themselves when sharing the RStudio Project directory?

Upvotes: 1

Views: 517

Answers (1)

Kevin Ushey
Kevin Ushey

Reputation: 21285

By default, packages within the renv project directory are symlinked from a global cache location. If you want to ensure packages are instead stored locally in the project library, you can use renv::isolate().

See https://rstudio.github.io/renv/reference/isolate.html for more details.

Upvotes: 3

Related Questions