Learn R Programming

renv (version 1.0.7)

lockfile-api: Programmatically Create and Modify a Lockfile

Description

This function provides an API for creating and modifying renv lockfiles. This can be useful when you'd like to programmatically generate or modify a lockfile -- for example, because you want to update or change a package record in an existing lockfile.

Usage

lockfile(file = NULL, project = NULL)

Arguments

file

The path to an existing lockfile. When no lockfile is provided, a new one will be created based on the current project context. If you want to create a blank lockfile, use file = NA instead.

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.

See Also

lockfiles, for a description of the structure of an renv lockfile.

Examples

Run this code

if (FALSE) {

lock <- lockfile("renv.lock")

# set the repositories for a lockfile
lock$repos(CRAN = "https://cran.r-project.org")

# depend on digest 0.6.22
lock$add(digest = "digest@0.6.22")

# write to file
lock$write("renv.lock")

}

Run the code above in your browser using DataLab