Restore a project's dependencies from a lockfile, as previously generated by
snapshot()
.
restore(project = NULL, library = NULL, lockfile = NULL,
actions = c("install", "remove", "upgrade", "downgrade", "crossgrade"),
confirm = interactive())
The project directory. If NULL
, then the active
project will be used. If no project has been specifically activated,
the current working directory is used.
The path to the library in which packages will be restored.
When NULL
, the project library is used.
The lockfile to be used for restoration of the associated
project. When NULL
, the most recently generated lockfile for this project
is used.
The restore actions to take. By default, all actions are taken, thereby synchronizing the state of the project library with that of the lockfile. See Actions for more details.
Boolean; prompt the user before taking any action?
renv
classifies the different actions that will be taken during restore
into five fundamental types:
|
Install a package recorded in the lockfile, but not currently installed in the project library. |
|
Remove a package installed in the project library, but not currently recorded in the lockfile. |
|
Upgrade a package by replacing the (older) version of the package available in the project library with a newer version as defined in the lockfile. |
|
Downgrade a package by replacing the (newer) version of the package available in the project library with an older version as defined in the lockfile. |
|
Install a package whose lockfile record differs from the inferred record associated with the currently-installed version. This could happen if, for example, the source of a particular package was changed (e.g. a package originally installed from GitHub was later installed from CRAN). |
This can be useful if you want to perform only non-destructive changes during
restore -- for example, you can invoke renv::restore(actions = "install")
to avoid modifying or removing packages that have already been installed into
your project's private library.