Learn R Programming

renv (version 0.6.0-92)

config: User-Level Configuration of renv

Description

Configure different behaviors of renv.

Arguments

Configuration

The following renv configuration options are available:

Name Type Description

auto.snapshot

logical(1) Automatically snapshot changes to the project library after a new package is installed with renv::install(), or removed with renv::remove()? (Boolean; defaults to TRUE)

connect.timeout

integer(1) The amount of time to spend (in seconds) when attempting to download a file. If you have already configured the R downloader (that is, you have set the download.file.method or download.file.extra R options), then this setting will be ignored. (Integer; defaults to 20)

connect.retry

integer(1) The number of times to attempt re-downloading a file, when transient errors occur. If you have already configured the R downloader (that is, you have set the download.file.method or download.file.extra R options), then this setting will be ignored. (Integer; defaults to 3)

sandbox.enabled

logical(1) Enable sandboxing for renv projects? When active, renv will attempt to sandbox the system library, preventing user-installed packages in the system library from becoming available in renv projects. (Boolean; defaults to FALSE)

shims.enabled

logical(1) Should renv shims be installed on package load? When enabled, renv will install its own shims over the functions install.packages(), update.packages() and remove.packages(), delegating these functions to renv::install(), renv::update() and renv::remove() as appropriate. (Boolean; defaults to TRUE)

snapshot.validate

logical(1) Validate R package dependencies when calling snapshot? When TRUE, renv will attempt to diagnose potential issues in the project library before creating renv.lock -- for example, if a package installed in the project library depends on a package which is not currently installed. (Boolean; defaults to TRUE)

Project-Local Settings

For settings that should persist alongside a particular project, the various settings available in settings can be used.

Details

For a given configuration option:

  1. If an R option of the form renv.config.<name> is available, then that option's value will be used;

  2. If an environment variable of the form RENV_CONFIG_<NAME> is available, then that option's value will be used;

  3. Otherwise, the default for that particular configuration value is used.

Any periods (.)s in the option name are transformed into underscores (_) in the environment variable name, and vice versa. For example, the configuration option auto.snapshot could be configured as:

  • options(renv.config.auto.snapshot = <...>)

  • Sys.setenv(RENV_CONFIG_AUTO_SNAPSHOT = <...>)

Note that if both the R option and the environment variable are defined, the R option will be used instead. Environment variables can be more useful when you want a particular configuration to be automatically inherited by child processes; if that behavior is not desired, then the R option may be preferred.

If you want to set and persist these options across multiple projects, it is recommended that you set them in your user startup files (e.g. in ~/.Rprofile or ~/.Renviron).

Examples

Run this code
# NOT RUN {
# disable automatic snapshots
options(renv.config.auto.snapshot = FALSE)

# disable with environment variable
Sys.setenv(RENV_CONFIG_AUTO_SNAPSHOT = "FALSE")

# }

Run the code above in your browser using DataLab