restore {renv} | R Documentation |
Restore project library from a lockfile
Description
Restore a project's dependencies from a lockfile, as previously generated by
snapshot()
. renv::restore()
compares packages recorded in the lockfile to
the packages installed in the project library. Where there are differences
it resolves them by installing the lockfile-recorded package into the
project library. If clean = TRUE
, restore()
will additionally delete any
packages in the project library that don't appear in the lockfile.
Usage
restore(
project = NULL,
...,
library = NULL,
lockfile = NULL,
packages = NULL,
exclude = NULL,
rebuild = FALSE,
repos = NULL,
clean = FALSE,
prompt = interactive()
)
Arguments
project |
The project directory. If |
... |
Unused arguments, reserved for future expansion. If any arguments
are matched to |
library |
The library paths to be used during restore. See Library for details. |
lockfile |
Path to a lockfile. When |
packages |
A subset of packages recorded in the lockfile to restore.
When |
exclude |
A subset of packages to be excluded during restore. This can be useful for when you'd like to restore all but a subset of packages from a lockfile. Note that if you attempt to exclude a package which is required as the recursive dependency of another package, your request will be ignored. |
rebuild |
Force packages to be rebuilt, thereby bypassing any installed versions of the package available in the cache? This can either be a boolean (indicating that all installed packages should be rebuilt), or a vector of package names indicating which packages should be rebuilt. |
repos |
The repositories to use when restoring packages installed from CRAN or a CRAN-like repository. By default, the repositories recorded in the lockfile will be, ensuring that (e.g.) CRAN packages are re-installed from the same CRAN mirror. Use |
clean |
Boolean; remove packages not recorded in the lockfile from
the target library? Use |
prompt |
Boolean; prompt the user before taking any action? For backwards
compatibility, |
Value
A named list of package records which were installed by renv.
See Also
Other reproducibility:
lockfiles
,
snapshot()
Examples
## Not run:
# disable automatic snapshots
auto.snapshot <- getOption("renv.config.auto.snapshot")
options(renv.config.auto.snapshot = FALSE)
# initialize a new project (with an empty R library)
renv::init(bare = TRUE)
# install digest 0.6.19
renv::install("digest@0.6.19")
# save library state to lockfile
renv::snapshot()
# remove digest from library
renv::remove("digest")
# check library status
renv::status()
# restore lockfile, thereby reinstalling digest 0.6.19
renv::restore()
# restore automatic snapshots
options(renv.config.auto.snapshot = auto.snapshot)
## End(Not run)