This functions aims to be used within a "snapshot-centered project
workflow" and can be used to downgrade all packages to an RSPM snapshot listed in
renv.lock
.
While the main purpose is downgrade packages which exist in a higher version, this function can also be used to restore a clean state of the project library outside of a downgrade scenario. Be aware of the handling of packages installed from remote sources (see section "Downgrading behavior").
Under the hood, it records all packages installed in the renv
project
library and restores these with the RSPM snapshot found in Line 7 of
renv.lock
.
Downgrading behavior 🚧️
There are important differences to be aware of when downgrading packages with respect to their installation source:
If a package is not available on CRAN,
renv_downgrade()
will restore the version from the remote source just fine.If a package is available on CRAN and a remote snapshot (e.g. from GitHub) was referenced in
renv.lock
,renv_downgrade()
will downgrade this package to its CRAN version of the respective snapshot and not keep the remote snapshot version.