2

I have been using renv on a R project, but now want to remove it from renv versioning, i.e. delete all renv associated files, but still have access to the libraries that I used installed under renv. How do I do this? Alternatively, how do I migrate from renv to packrat?

4

2 回答 2

2

From RStudio's documentation, link provided by Kevin:

To deactivate renv in a project, use renv::deactivate(). This removes the renv auto-loader from the project .Rprofile, but doesn’t touch any other renv files used in the project. If you’d like to later re-activate renv, you can do so with renv::activate().

To remove renv from a project, use renv::deactivate() to first remove the renv auto-loader from the project .Rprofile, then delete the project’s renv folder and renv.lock lockfile as desired.

If you want to completely remove any installed renv infrastructure components from your entire system, you can do so with the following R code:

root <- renv::paths$root()
unlink(root, recursive = TRUE)

The renv package can then also be uninstalled via:

utils::remove.packages("renv")

Note that if you’ve customized any of renv’s infrastructure paths as described in ?renv::paths, then you’ll need to find and remove those customized folders as well.

于 2020-06-30T08:38:14.290 回答
0

Have you tried renv::isolate? That should bring over all the libraries from the renv shared cache into the local project directory? But perhaps that's not what you want to do?

于 2020-04-23T23:37:52.643 回答