lockfile-metadata: Get / Set packrat lockfile metadata

Description Usage Arguments Details available metadata Examples

Description

Get and set metadata in the current packrat-managed project lockfile packrat.lock

Usage

1
2
3
4
set_lockfile_metadata(repos = NULL, r_version = NULL, project = NULL)

get_lockfile_metadata(metadata = NULL, simplify = TRUE,
  project = NULL)

Arguments

repos

A named character vector of the form c(<repoName> = "<pathToRepo>").

r_version

A length-one character vector with suitable numeric version string. See package_version.

project

The project directory. When in packrat mode, defaults to the current project; otherwise, defaults to the current working directory.

metadata

The lockfile field name(s) to draw from.

simplify

Boolean; if TRUE the returned metadata will be un-listed.

Details

Project's packrat.lock contains some metadata before packages dependencies informations. The project's lockfile is created and updated programmatically by snapshot. However it could be necessary sometimes to modify manually some of those values. For example, it could be useful to set another repository CRAN url when deploying to a offline environnement.

available metadata

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
# changes repos url
repos <- old_repos <- get_lockfile_metadata("repos")
repos
repos["CRAN"] <- "https://cran.r-project.org/"
set_lockfile_metadata(repos = repos)
get_lockfile_metadata("repos")
# setting back old state
# set_lockfile_metadata(repos = old_repos)

# changes R version
rver <- old_rver <- get_lockfile_metadata("r_version")
rver
rver <- "3.4.1"
set_lockfile_metadata(r_version = rver)
get_lockfile_metadata("r_version")
# Setting back old state
# set_lockfile_metadata(r_version = old_rver)

## End(Not run)

packrat documentation built on March 30, 2021, 5:12 p.m.