Create an renv lockfile from a variety of sources.
Arguments
- from
The source from which the lockfile should be created. This can be:
NULL(the default), in which case the lockfile is created from the state of the active project's library;The path to a Posit Connect
manifest.jsonfile, or a manifest that has already been read in as an R list, in which case the manifest is converted into a lockfile.
The set of supported sources may be expanded in future releases of
renv.- to
The path to a lockfile to be written. When
NULL(the default), the lockfile is returned as an R object and not written to disk; otherwise, the lockfile is written totoand returned invisibly.- 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.
Value
An renv lockfile, as an R object of class renv_lockfile. When to
is supplied, the lockfile is returned invisibly.
Details
lockfile() provides a generic entry point for producing an renv
lockfile. The kind of lockfile produced depends on the value supplied as
from; for example, given the path to a Posit Connect manifest.json
file, lockfile() will convert that manifest into a lockfile.
By default the lockfile is returned as an R object. Supply to to also
write it to disk, after which restore() can be used to restore the
associated project library.
See also
lockfiles, for a description of the structure of an
renv lockfile.