renv::plan() resolves the packages required by a project and generates
a lockfile, without installing any packages. This allows you to see what
renv::restore() would do before actually performing the installation.
Usage
plan(
packages = NULL,
...,
dependencies = NULL,
lockfile = paths$lockfile(project = project),
project = NULL
)Arguments
- packages
The packages to be included in the plan. When
NULL(the default), all packages currently used in the project will be included, as determined bydependencies().- ...
Unused arguments, reserved for future expansion. If any arguments are matched to
..., renv will signal an error.- dependencies
A vector of DESCRIPTION field names that should be used for package dependency resolution. When
NULL(the default), the value ofrenv::settings$package.dependency.fieldsis used. The aliases "strong", "most", and "all" are also supported. Seetools::package_dependencies()for more details.- lockfile
The path where the generated lockfile should be written. Use
NULLto skip writing the lockfile.- project
The project directory. If
NULL, then the active project will be used. If no project is currently active, then the current working directory is used instead.
Details
Because packages are not installed, the generated lockfile is based on
package metadata from the configured repositories (i.e. the PACKAGES
file). This means the lockfile may contain only a subset of the fields
that would be present in a lockfile generated by snapshot(),
which reads the full DESCRIPTION from installed packages. The
generated lockfile is still suitable for use with restore().
Examples
if (FALSE) { # \dontrun{
# plan the packages required by the current project
renv::plan()
# plan a specific set of packages
renv::plan(packages = c("dplyr", "ggplot2"))
} # }