Learn R Programming

renv (version 0.8.0)

lockfile: Lockfiles

Description

A lockfile records the state of a project at some point in time. In particular, this implies capturing the R packages installed (along with their versions) within the project's private library.

Arguments

[renv]

Information about the version of renv used to manage this project.

Version The version of the renv package used with this project.

[R]

Properties related to the version of R associated with this project.

Version The version of R used.
Repositories The R repositories used in this project.

[Packages]

R package records, capturing the packages used or required by a project at the time when the lockfile was generated.

Package The package name.
Version The package version.
Source The location from which this package was retrieved.
Repository The name of the repository (if any) from which this package was retrieved.
Hash (Optional) A unique hash for this package, used for package caching.

Additional remote fields, further describing how the package can be retrieved from its corresponding source, will also be included as appropriate (e.g. for packages installed from GitHub).

[Python]

Metadata related to the version of Python used with this project (if any).

Version The version of Python being used.
Type The type of Python environment being used ("virtualenv", "conda", "system")

Note that the Name field may be empty. In that case, a project-local Python environment will be used instead (when not directly using a system copy of Python).

Details

Projects can be restored from a lockfile using the restore() function. This implies re-installing packages into the project's private library, as encoded within the lockfile.

While lockfiles are normally generated and used with snapshot() / restore(), they can also hand-edited if so desired. Lockfiles are written as .json, to allow for easy consumption by other tools.

An example lockfile follows:

{
  "renv": {
    "Version": "1.0.0"
  },
  "R": {
    "Version": "3.6.1",
    "Repositories": [
      {
        "Name": "CRAN",
        "URL": "https://cloud.r-project.org"
      }
    ]
  },
  "Packages": {
    "markdown": {
      "Package": "markdown",
      "Version": "1.0",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "4584a57f565dd7987d59dda3a02cfb41"
    },
    "mime": {
      "Package": "mime",
      "Version": "0.7",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "908d95ccbfd1dd274073ef07a7c93934"
    }
  }
}

The sections used within a lockfile are described next.

See Also

Other reproducibility: restore(), snapshot()