restoreEnvironment: Restore the R environment to a snapshot

View source: R/EnvironmentSnapshot.R

restoreEnvironmentR Documentation

Restore the R environment to a snapshot

Description

Restore the R environment to a snapshot

Usage

restoreEnvironment(
  snapshot,
  stopOnWrongRVersion = FALSE,
  strict = FALSE,
  skipLast = TRUE
)

Arguments

snapshot

The snapshot data frame as generated using the takeEnvironmentSnapshot function.

stopOnWrongRVersion

Should the function stop when the wrong version of R is installed? Else just a warning will be thrown when the version doesn't match.

strict

If TRUE, the exact version of each package will installed. If FALSE, a package will only be installed if (a) a newer version is required than currently installed, or (b) the major version number is different.

skipLast

Skip last entry in snapshot? This is usually the study package that needs to be installed manually.

Details

This function restores the R environment to a previous snapshot, meaning all the packages will be restored to the versions they were at at the time of the snapshot. Note: on Windows you will very likely need to have RTools installed to build the various packages.

Examples

## Not run: 
snapshot <- takeEnvironmentSnapshot("OhdsiRTools")
write.csv(snapshot, "snapshot.csv")

# 5 years later

snapshot <- read.csv("snapshot.csv")
restoreEnvironment(snapshot)

## End(Not run)

OHDSI/OhdsiRTools documentation built on June 7, 2022, 12:20 p.m.