renv uses a lockfile to capture the
state of your library at some point in time. It is stored as a
collection of records, with different records defining:
renv used when generating the
lockfile;R used in that project;Here is an example lockfile, including the packages
markdown and mime:
{
"R": {
"Version": "4.1.2",
"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 function renv::snapshot() is used to create this
lockfile, and by default writes these records to the file
renv.lock. Later, if you need to reinstall the specific
package versions as recorded in renv.lock, you can use
renv::restore().