Skip to contents

A repository can record the package versions its analysis used: an renv.lock file, a sessionInfo() or session_info() record, or a date in a groundhog.library() or checkpoint() call (see .code_version_pin_check()). This matches those records to the packages the scripts load, because only those are installed: a listed package no script loads is left out, and a loaded package that is not listed keeps NA and is installed at its current version.

Usage

.repro_recorded_plan(deps, version_pin, use_dates = TRUE)

Arguments

deps

the frame from repro_dependencies(): package, source, ref, base

version_pin

the result of .code_version_pin_check()

use_dates

FALSE not to look up the versions for a date, which needs the network; such a package then keeps NA

Value

NULL when nothing records a version of a package the scripts load, else a list: deps (the non-base rows of deps, with version and recorded_from), kept_with_r (data frame package, version), dates (the date used, or character(0)) and date_failed (TRUE when the date's versions could not be looked up)

Details

renv.lock comes first, then the sessionInfo() and session_info() records, then a date, the latest one when there are several. Within one kind of record the highest version wins when files disagree, since a run has one library. A package whose record says it came from GitHub is installed from that commit.

groundhog, checkpoint and renv are left out: the scripts' calls to them are rewritten (see repro_write_scripts()), since they would install packages themselves, which needs the network that is off during a run.

Packages that come with R (Matrix, MASS, ...) keep R's own version, since they are built for that R version, and are listed in kept_with_r.