2

I want to test the potential function of the collective maintenance of the R scripts across individuals. I try to work on Rstudio project together with the Could software eg. Dropbox and the version control (eg. Git), so we can have all the records of all the updates from different maintainers. Therefore, I try to test the new released R package renv.

On my Mac OS, my newly installed packages are available in the 1st directory as I listed below.

.libPaths()
## [1] "/Library/Frameworks/R.framework/Versions/library"              
## [2] "/Library/Frameworks/R.framework/Versions/3.6/Resources/library"

However when I start the renv with the renv::init(). It only has the basic packages available. How can I move these installed packages into the global cache directly without the need to reinstall these pacakges?

Phil
  • 7,287
  • 3
  • 36
  • 66
johnsonzhj
  • 517
  • 1
  • 5
  • 23

1 Answers1

3

You can simply call renv::install() (or renv::restore()) and renv will find packages already installed in the cache. It's possible because all the projects using renv share the global package cache, therefore, the project libraries are composed by symlinks associated to the global package cache.

In case that renv global package cache and the project library are installed in different disk volumes, renv will copy the package from the cache into the project library, instead of using a symlink.

In macOS, the default location of renv global packages caches is: ~/Library/Application Support/renv.

All the information was extracted from the following link: https://cran.r-project.org/web/packages/renv/vignettes/renv.html.

I hope it helps you. Good luck!

rodolfoksveiga
  • 1,181
  • 4
  • 17