Learn R Programming

RSuite (version 0.37-253)

prj_lock_env: Locks the project environment.

Description

It collects all dependencies' versions and stores them in lock file to enforce exact dependency versions in the future.

Usage

prj_lock_env(prj = NULL)

Arguments

prj

project object to be locked. If not passed the loaded project will be locked or the default whichever exists. Will init default project from the working directory if no default project exists. (type: rsuite_project, default: NULL)

Details

The lock file is saved in <my_project>/deployment/ under 'env.lock' name. It is in dcf format with information about packages installed in local project environment together with their versions. A sample record from the lock file:

Package: RSuite Version: 0.26.235

When dependencies are being installed (using prj_install_deps) the 'env.lock' file will be used to detect whether any package will change versions. If that's the case a warning message will be displayed like this:

...:rsuite: The following packages will be updated from the last lock: colorspace

The feature allows preventing errors caused by newer versions of packages which might work differently than previous versions used in the project.

See Also

Other in project management: prj_build, prj_clean_deps, prj_init, prj_install_deps, prj_load, prj_pack, prj_start_package, prj_start, prj_unload, prj_zip

Examples

Run this code
# NOT RUN {
  # create exemplary project base folder
  prj_base <- tempfile("example_")
  dir.create(prj_base, recursive = TRUE, showWarnings = FALSE)

  # start project
  prj <- prj_start("my_project", skip_rc = TRUE, path = prj_base)

  # build project local environment
  prj_install_deps(prj = prj)

  # lock project environment
  prj_lock_env(prj = prj)

  # present contents of lock file created
  cat(readLines(file.path(prj$path, "deployment", "env.lock")), sep = "\n")
# }

Run the code above in your browser using DataLab