Configure different behaviors of renv.
configAn object of class list of length 36.
The following renv configuration options are available:
renv::snapshot() and renv::restore() use the project library. See ?renv::activate for more details.
Defaults to TRUE.
renv auto-loader? When FALSE, renv will not not automatically load a project containing an renv autoloader within its .Rprofile. In addition, renv will not write out the project auto-loader in calls to renv::init().
Defaults to TRUE.
FALSE.
"api.bitbucket.org/2.0".
"auto".
curl downloader is used.
Defaults to 20L.
curl downloader is used.
Defaults to 3L.
renv package cache? When active, renv will install packages into a global cache, and link or copy packages from the cache into your R library as appropriate. This can greatly save on disk space and install time when R packages are shared across multiple projects in the same environment.
Defaults to TRUE.
renv package cache into your project library? When TRUE, renv will use symlinks (or, on Windows, junction points) to reference packages installed in the cache. Set this to FALSE if you'd prefer to copy packages from the cache into your project library. Enabled by default, except on Windows where this feature is only enabled if the project library and global package cache are on the same volume.
Defaults to NULL.
renv APIs require the enumeration of your project's R package dependencies. This option controls how errors that occur during this enumeration are handled. By default, errors are reported but are non-fatal. Set this to "fatal" to force errors to be fatal, and "ignored" to ignore errors altogether. See dependencies() for more details.
Defaults to "reported".
library(renv) is called, should its exports be placed on the search path? Set this to FALSE to avoid issues that can arise with, for example, renv::load() masking base::load(). In general, we recommend referencing renv functions from its namespace explicitly; e.g. prefer renv::snapshot() over snapshot().
By default, all exported renv functions are attached and placed on the search path, for backwards compatibility with existing scripts using renv.
Defaults to "*".
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 via .expand_R_libs_env_var() as necessary.
Defaults to NULL.
renv file-backed cache? When enabled, renv will cache the contents of files that are read (e.g. DESCRIPTION files) in memory, thereby avoiding re-reading the file contents from the filesystem if the file has not changed. renv uses the file mtime to determine if the file has changed; consider disabling this if mtime is unreliable on your system.
Defaults to TRUE.
"api.github.com".
"gitlab.com".
hydrate() when attempting to hydrate projects. When empty, the default set of library paths (as documented in ?hydrate) are used instead. See hydrate() for more details.
Defaults to NULL.
R CMD build) before installation? When TRUE, package vignettes will also be built as part of package installation. Because building packages before installation may require packages within 'Suggests' to be available, this option is not enabled by default.
Defaults to FALSE.
renv discovers that a package to be installed is already available within the user or site libraries, then it will install a local copy of that package.
Defaults to TRUE.
renv.config.install.transactional instead.
Defaults to TRUE.
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.
Defaults to TRUE.
TRUE, renv will stream any output generated during package build + installation to the console.
Defaults to FALSE.
renv project, while minimizing risks relating to concurrent access to the project library. Disable this if you encounter locking issues. Locks are stored as files within the project at renv/lock; if you need to manually remove a stale lock you can do so via unlink("renv/lock", recursive = TRUE).
Defaults to FALSE.
vignette("mran", package = "renv") for more details.
Defaults to TRUE.
FALSE.
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.
Defaults to NULL.
renv projects? When TRUE, renv will attempt to transform the repository URLs used by RSPM into binary URLs as appropriate for the current platform. Set this to FALSE if you'd like to continue using source-only RSPM URLs, or if you find that renv is improperly transforming your repository URLs.
Defaults to TRUE.
renv projects? When active, renv will attempt to sandbox the system library, preventing non-system packages installed in the system library from becoming available in renv projects. (That is, only packages with priority "base" or "recommended", as reported by installed.packages(), are made available.)
Sandboxing is done by linking or copying system packages into a separate library path, and then instructing R to use that library path as the system library path. In some environments, this action can take a large amount of time -- in such a case, you may want to disable the renv sandbox.
Defaults to FALSE.
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 install(), update() and remove() as appropriate.
Defaults to TRUE.
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.
Defaults to TRUE.
renv will not display the typical Project <path> loaded. [renv <version>] banner on startup.
Defaults to NULL.
TRUE.
FALSE.
2L.
~/.Renviron) when renv is loaded?
Defaults to TRUE.
renv.config.external.libraries option.
Defaults to FALSE.
~/.Rprofile) when renv is loaded? This is disabled by default, as running arbitrary code from the the user ~/.Rprofile could risk breaking project encapsulation. If your goal is to set environment variables that are visible within all renv projects, then placing those in ~/.Renviron is often a better choice. Defaults to FALSE.If you find that renv is unable to copy some directories in your
environment, you may want to try setting the copy.method option. By
default, renv will try to choose a system tool that is likely to succeed in
copying files on your system -- robocopy on Windows, and cp on Unix.
renv will also instruct these tools to preserve timestamps and attributes
when copying files. However, you can select a different method as
appropriate.
The following methods are supported:
auto |
Use robocopy on Windows, and cp on Unix-alikes. |
R |
Use R's built-in file.copy() function. |
cp |
Use cp to copy files. |
robocopy |
Use robocopy to copy files. (Only available on Windows.) |
rsync |
Use rsync to copy files. |
You can also provide a custom copy method if required; e.g.
options(renv.config.copy.method = function(src, dst) {
# copy a file from 'src' to 'dst'
})
Note that renv will always first attempt to copy a directory first to a
temporary path within the target folder, and then rename that temporary path
to the final target destination. This helps avoid issues where a failed
attempt to copy a directory could leave a half-copied directory behind
in the final location.
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 a a startup .Renviron file; e.g. in your
own ~/.Renviron, or in the R installation's etc/Rprofile.site file. See
Startup for more details.
# 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