Finds the packages in use in the project, and stores a list of those packages, their sources, and their current versions in packrat.
snapshot(
project = NULL,
available = NULL,
lib.loc = libDir(project),
ignore.stale = FALSE,
dry.run = FALSE,
prompt = interactive(),
snapshot.sources = TRUE,
infer.dependencies = TRUE
)
The project directory. Defaults to current working directory.
A database of available packages.
The library to snapshot. Defaults to the private library associated with the given directory.
Stale packages are packages that are different from the
last snapshot, but were installed by packrat. Typically, packages become
stale when a new snapshot is available, but you haven't applied it yet with
restore
. By default, packrat will prevent you from taking a
snapshot when you have stale packages to prevent you from losing changes
from the unapplied snapshot. If your intent is to overwrite the last
snapshot without applying it, use ignore.stale = TRUE
to skip this
check.
Computes the changes to your packrat state that would be made if a snapshot were performed, and prints them to the console.
TRUE
to prompt before performing snapshotting package
changes that might be unintended; FALSE
to perform these operations
without confirmation. Potentially unintended changes include snapshotting
packages at an older version than the last snapshot, or missing despite
being present in the last snapshot.
Boolean; should package sources be downloaded during snapshot?
If TRUE
, infer package dependencies by
examining R code used within the project. This included the R code
contained within .R
files, as well as other multi-mode documents
(e.g. .Rmd
).
snapshot
modifies the project's packrat.lock
file, and
the sources stored in the project's packrat/src
directory. If you
are working with a version control system, your collaborators can sync the
changes to these files and then use restore
to apply your
snapshot.
if (FALSE) { # \dontrun{
# Take a snapshot of the current project
snapshot()
# See what changes would be included in a snapshot
snapshot(dry.run = TRUE)
} # }