renv
Check where your package is installed
find.package("dplyr")
## [1] "C:/Program Files/R/R-4.0.3/library/dplyr"
All projects use the same library path. Then for each project, you need different library dependencies.
Intializing a project
renv::init()
A .Rprofile
is created that forks the current R libraries.
Now, you can work as before. But the current state of packages would not change.
Snapshot
renv::snapshot()
The function tells you the current state of a project, and whether you can to update any packages in that project.
The lockfile is a JSON file that tells you packages installed in your project, versions, and sources.
This is useful for:
- Time capsules (you can return to this project in the future without any unexpected changes)
- Collaborative workflows (different people might have different packages installed).
- Deployments (you can run your project remotely)
Restore
To restore the previously snapshot, you can use
renv::restore()
## * The library is already synchronized with the lockfile.