These provide top-level, powerful settings for a comprehensive reproducible workflow. See Details below.
Details
RequireOptions()prints the default values of package options set at startup, which may have been changed (e.g., by the user) during the current session.
getRequireOptions()prints the current values of package options.
Below are options that can be set with options("Require.xxx" = newValue),
where xxx is one of the values below, and newValue is a new value to give
the option. Sometimes these options can be placed in the user's .Rprofile
file so they persist between sessions.
The following options are likely of interest to most users:
installDefault:
TRUE. This is the default argument toRequire, but does not affectInstall. If this isFALSE, then no installations will be attempted, and missing packages will result in an error.cachePkgDirDeprecated, and ignored under
Require.usePak = TRUE(the default): redirect pak's package cache with theR_USER_CACHE_DIRenvironment variable instead.R_REQUIRE_PKG_CACHEis deprecated for the same reason. Both are still honoured whenRequire.usePak = FALSE. Default:cacheGetOptionCachePkgDir(), which must be either a path or a logical. To turn off package caching, set this toFALSE. This can be set using an environment variable e.g.,Sys.setenv(R_REQUIRE_PKG_CACHE = "somePath"), orSys.setenv(R_REQUIRE_PKG_CACHE = "TRUE"); if that is not set, then an either a path or logical option (options(Require.cachePkgDir = "somePath")oroptions(Require.cachePkgDir = TRUE)). IfTRUE, the default folder locationcachePkgDir()will be used. If this isTRUEor a path is provided, then binary and source packages will be cached here. Subsequent downloads of same package will use local copy. Default is to have packages not be cached locally so each install of the same version will be from the original source, e.g., CRAN, GitHub.otherPkgsDefault: A character vector of packages that are generally more successful if installed from Source on Unix-alikes. Since there are repositories that offer binary packages builds for Linux (e.g., RStudio Package Manager), the vector of package names indicated here will default to a standard CRAN repository, forcing a source install. See also
spatialPkgsoption, which does the same for spatial packages.noRemotesDefault:
FALSE. IfTRUE, GitHub-style specs (account/repo@branch) passed toRequire/Installare rewritten to their bare package name (the version constraint, if any, is preserved). The packages are then resolved fromrepos(e.g., a CRAN-like or r-universe repository serving prebuilt binaries) instead of being cloned and built from GitHub source. This avoids the need for git authentication and a source-build toolchain (e.g., Rtools on Windows), which is useful for workshops and other binary-only setups. Because version constraints are kept,reposmust provide a version that satisfies them, otherwise resolution will fail (rather than silently falling back to GitHub). Ensure the relevant repository (e.g.,predictiveecology.r-universe.dev) is ingetOption("repos").purgeDefault:
FALSE. If set to (almost) all internal caches used byRequirewill be deleted and rebuilt. This should not generally be necessary as it will automatically be deleted after (by default) 1 hour (set viaR_AVAILABLE_PACKAGES_CACHE_CONTROL_MAX_AGEenvironment variable in seconds).cloneFromDefault:
NULL. A path to an existing package library. When set, any package that is already installed there at the version being requested is copied or hard-linked into the destination library instead of being downloaded and installed, which is much faster when populating a new project library on a machine that already has the packages. Only packages that need no compilation and were built under a compatible R version are cloned; the rest go through the normal install machinery, as dopak,callr,processxandcli, whose native helper executables do not survive a file-by-file copy. Has no effect underRequire.usePak = TRUE(the default): cloning lives in the legacy (non-pak) install path, so this option is consulted only whenRequire.usePak = FALSE.downloadTimeoutDefault:
300L(seconds). Used as the floor foroptions("timeout")during GitHub source-archive downloads in the legacy (non-pak) install path. R's stock 60-second timeout is too short for slow connections fetching multi-MB zips. Has no effect underRequire.usePak = TRUE, which delegates downloads to pak's own libcurl client.spatialPkgsDefault: A character vector of packages that are generally more successful if installed from Source on Unix-alikes. Since there are repositories that offer binary packages builds for Linux (e.g., Posit Package Manager), the vector of package names indicated here will default to a standard CRAN repository, forcing a source install. See also
otherPkgsoption, which does the same for non-spatial packages.useCranCacheDefault:
FALSE. A user can optionally use the locally cached packages that are available due to a user's use of thecrancachepackage.checkInternetDefault:
TRUE. WhetherRequiremay run a short internet probe before work that needs the network. Results are cached forRequire.internetExistsTimeoutseconds (30). Setting thisFALSEskips the probe at most call sites, but not those that passforce = TRUE, where failing late costs more than a 2-second check.forcePakReinstallDefault:
FALSE. SetTRUEto force one cleaninstall.packages("pak")into the project library. This is the remedy for a pak whose bundled callr/processx helper executables no longer run – the state a file-by-file copy of a library leaves pak in.find.package()cannot detect that (every file is present, they just do not run), so the reinstall has to be asked for explicitly.installPackagesSysDefault:
2L. Legacy (non-pak) path only.0installs in-process withinstall.packages(); a non-zero value runs builds and installs through thesyspackage in a subprocess;2additionally performs the CRAN downloads itself rather than leaving them toinstall.packages(). Requires thesyspackage.offlineModeDefault:
FALSE. WhenTRUE,Requireattempts no network access and installs only from local caches. It is also set automatically – together withRequire.offlineModeSetAutomatically– when an install fails and an internet probe finds no connection.packageVersionFileDefault:
"packageVersions.txt". The default file path used bypkgSnapshot()when writing a snapshot.snapshotInstallerDefault:
"pak". Which installer to use for a snapshot install."install.packages"selects the pre-pak chain, which is retained but no longer developed. See?pkgSnapshotfor the rest of the snapshot-installer options.snapshotInstallerUsePPMDefault:
TRUE. Prepend a Posit Package Manager binary repository when installing a snapshot through theinstall.packageschain. PPM serves macOS binaries by content-negotiating theR/<version>User-Agent.standAloneDefault:
TRUE. The defaultstandAloneargument forRequire,InstallandsetLibPaths().TRUEmeans the given library path is used on its own, without the user and site libraries appended;FALSEappends them. It controls whether those libraries are added, not how many library paths may be given – passing several is always allowed.updateRprofileDefault:
FALSE. WhethersetLibPaths()also writes the library path into the project.Rprofile, so it persists across sessions.usePakDefault:
TRUE. Use pak to resolve and install packages.FALSEselects the pre-pak path. Several options apply only to that path and do nothing under the default:cachePkgDir,cloneFrom,downloadTimeoutandinstallPackagesSys.verboseDefault:
1. See ?Require.