Create a renv lock file

  mode = "auto",
  includeRootPackage = TRUE,
  additionalRequiredPackages = NULL,
  ohdsiGitHubPackages = getOhdsiGitHubPackages(),
  ohdsiStudiesGitHubPackages = rootPackage,
  fileName = "renv.lock",
  restart = (mode == "auto")



The name of the root package, the package that we'd like to be able to run in the end.


Can be "auto" or "description". See details.


Include the root package in the renv file?


Additional packages we want to have installed (with their dependencies), such as 'keyring'. Ignored if mode = "auto".


Names of R packages that need to be installed from the OHDSI GitHub.


Names of R packages that need to be installed from the OHDSI-Studies GitHub.


Name of the lock file to be generated. Ignored if mode = "auto".


Boolean; attempt to restart the R session after initializing the project?


Does not return a value. Is executed for the side-effect of creating the lock file.


Create a lock file that allows reconstruction of the R environment using the renv package. This function will include the root file and all of its dependencies in the lock file, requiring the same package versions as currently installed on this computer.

If mode = "auto", this function will invoke renv::init(), which in turn will scan the project folders for any dependencies that are referenced. Afterwards, references to OHDSI packages will be altered so the correct GitHub tags are used for the installed versions.

If mode = "description", this function will assume the project is a full-fledged R package with up-to-date DESCRIPTION, and will only install the dependencies listed in the DESCRIPION.

The second option tends to lead to smaller lock files, but requires all dependencies are accurately listed in the DESCRIPTION file of the study package.