How to completely remove renv from an R statistics program
Asked Answered
P

2

7

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?

Puffery answered 18/4, 2020 at 23:35 Comment(0)
A
10

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.

Alastair answered 30/6, 2020 at 8:38 Comment(0)
T
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?

Thinkable answered 23/4, 2020 at 23:37 Comment(1)
That that is part of the answer, but how do I also get rid of all the renv files in the project, switch any setting from renv back to standard, and turn off any process it may have started, i.e uninstall renv?Puffery

© 2022 - 2024 — McMap. All rights reserved.