Configure different behaviors of renv
.
The following renv
configuration options are available:
Name | Type | Default | Description |
|
logical[1] |
FALSE |
Automatically snapshot changes to the project library after a new package
is installed with renv::install() , or removed with renv::remove() ?
|
|
integer[1] |
20L |
The amount of time to spend (in seconds) when attempting to download a
file. Only used when the curl downloader is used.
|
|
integer[1] |
3L |
The number of times to attempt re-downloading a file, when transient
errors occur. Only used when the curl downloader is used.
|
|
character[*] |
character() |
A character vector of external libraries, to be used in tandem with your
projects. Be careful when using external libraries: it's possible that
things can break within a project if the version(s) of packages used in
your project library happen to be incompatible with packages in your
external libraries; for example, if your project required xyz 1.0 but
xyz 1.1 was present and loaded from an external library. Can also be an
R function that provides the paths to external libraries. Library paths
will be expanded through .expand_R_libs_env_var as necessary.
|
|
logical[1] |
TRUE |
Perform a staged install of packages during install and restore?
When enabled, renv will first install packages into a temporary
library, and later copy or move those packages back into the project
library only if all packages were successfully downloaded and installed.
This can be useful if you'd like to avoid mutating your project library
if installation of one or more packages fails.
|
|
character[*] |
NULL |
Override the R package repositories used during restore. Primarily
useful for deployment / continuous integration, where you might want
to enforce the usage of some set of repositories over what is defined
in renv.lock or otherwise set by the R session.
|
|
logical[1] |
FALSE |
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.
|
|
logical[1] |
TRUE |
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.
|
|
logical[1] |
TRUE |
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.
|
|
logical[1] |
FALSE |
Check for package updates when the session is initialized? This can be useful if you'd like to ensure that your project lockfile remains up-to-date with packages as they are released on CRAN. |
|
integer[1] |
2L |
Check for package updates in parallel? This can be useful when a large number of packages installed from non-CRAN remotes are installed, as these packages can then be checked for updates in parallel. |
|
logical[1] |
FALSE |
Include the user library on the library paths for your projects? Note that
this risks breaking project encapsulation and is not recommended for
projects which you intend to share or collaborate on with other users. See
also the caveats for the external.libraries option.
|
|
logical[1] |
TRUE |
Load the user R profile (typically located at ~/.Rprofile ) when renv
is loaded? Consider disabling this if you require extra encapsulation in
your projects; e.g. if your .Rprofile attempts to load packages that
you might not install in your projects.
|
For settings that should persist alongside a particular project, the various settings available in settings can be used.
For a given configuration option:
If an R option of the form renv.config.<name>
is available,
then that option's value will be used;
If an environment variable of the form RENV_CONFIG_<NAME>
is available,
then that option's value will be used;
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
).
# 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