plan: Plan package installations

View source: R/plan.R

planR Documentation

Plan package installations

Description

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 by dependencies().

...

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 of renv::settings$package.dependency.fields is used. The aliases "strong", "most", and "all" are also supported. See tools::package_dependencies() for more details.

lockfile

The path where the generated lockfile should be written. Use NULL to 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().

Value

The generated lockfile, invisibly.

Examples

## Not run: 

# plan the packages required by the current project
renv::plan()

# plan a specific set of packages
renv::plan(packages = c("dplyr", "ggplot2"))


## End(Not run)

renv documentation built on March 25, 2026, 5:07 p.m.