Difference with renv
renv
is the most popular R package manager in the R ecosystem.
It helps you “create reproducible environments for your R projects”.
But renv
is not without its issues, many of which lead to the decision to create rv
. To fully grasp these issues,
we need a bit of renv
background.
In renv
, users iteratively install packages, then retroactively “snapshot” the current project status to generate a lockfile by calling renv::snapshot
.
The lockfile contains 3 main components:
Version
- The R version used in the projectRepositories
- A list of repositories where packages were installed from. This is generated by whatever repositories are set inoptions("repos")
Packages
- Contains information about each package used in the project, derived from the installed package’s DESCRIPTION file, including its name, version, and data useful to recreate the installation.
A renv
snapshot is exactly what it sounds like, it “snapshots” the project status by inspecting the R version, set repositories, and installed packages.
This sounds okay in theory, but in practice, these iterative, retroactive snapshots miss crucial information about how, when, and from where a package is installed.
rv
takes a completely different approach than renv
. Instead of iteratively installing packages and retroactively capturing the state, rv
holistically installs the packages
you require in your library, ensuring the full dependency tree is resolvable before any package is installed. Even as you add new packages to your project, rv
is ensuring each
package is compatible with the library at each installation.
Additionally, because rv
is handling installation and locking in one step, tracking of how, when, and from where packages are installed can be done more precisely,
completely removing the risk of missing information.
Conclusion
Section titled “Conclusion”Ultimately, renv
and rv
get you to similar spots in different ways. renv
philosophically tries to capture the status of the used packages within your project
and leaves it up to the user to determine how to get there and when to snapshot. rv
allows the user to declare the desired state of the project, then the tool takes the rest
to ensure the project is in a resolvable, reproducible, and consistent state.