R: Environment Variables (original) (raw)
Details of some of the environment variables which affect an R session.
It is impossible to list all the environment variables which can affect an R session: some affect the OS system functions which Ruses, and others will affect add-on packages. But here are notes on some of the more important ones. Those that set the defaults for options are consulted only at startup (as are some of the others).
HOME:
The user's ‘home’ directory.
LANGUAGE:
Optional. The language(s) to be used for message translations. This is consulted when needed.
LC_ALL:
(etc) Optional. Use to set various aspects of the locale – see [Sys.getlocale](../../base/help/Sys.getlocale.html)
. Consulted at startup.
MAKEINDEX:
The path to makeindex
. If unset to a value determined when R was built. Used by the emulation mode of [texi2dvi](../../tools/html/texi2dvi.html)
and[texi2pdf](../../tools/html/texi2dvi.html)
.
R_BATCH:
Optional – set in a batch session, that is one started by R CMD [BATCH](../../utils/html/BATCH.html)
. Most often set to""
, so test by something like!is.na([Sys.getenv](../../base/help/Sys.getenv.html)("R_BATCH", NA))
.
R_BROWSER:
The path to the default browser. Used to set the default value of [options](../../base/help/options.html)("browser")
.
R_COMPLETION:
Optional. If set to FALSE
, command-line completion is not used. (Not used by the macOS GUI.)
R_DEFAULT_PACKAGES:
A comma-separated list of packages which are to be attached in every session. See [options](../../base/help/options.html)
.
R_DOC_DIR:
The location of the R ‘doc’ directory. Set by R.
R_ENVIRON:
Optional. The path to the site environment file: see Startup. Consulted at startup.
R_GSCMD:
Optional. The path to Ghostscript, used by[dev2bitmap](../../grDevices/html/dev2bitmap.html)
, [bitmap](../../grDevices/html/dev2bitmap.html)
and[embedFonts](../../grDevices/html/embedFonts.html)
. Consulted when those functions are invoked. Since it will be treated as if passed to[system](../../base/help/system.html)
, spaces and shell metacharacters should be escaped.
R_HISTFILE:
Optional. The path of the history file: see Startup. Consulted at startup and when the history is saved.
R_HISTSIZE:
Optional. The maximum size of the history file, in lines. Exactly how this is used depends on the interface.
On Unix-alikes,
for the readline
command-line interface it takes effect when the history is saved (by [savehistory](../../utils/html/savehistory.html)
or at the end of a session).
On Windows,
for Rgui
it controls the number of lines saved to the history file: the size of the history used in the session is controlled by the console customization: see [Rconsole](../../utils/html/Rconsole.html)
.
R_HOME:
The top-level directory of the Rinstallation: see [R.home](../../base/help/R.home.html)
. Set by R.
R_INCLUDE_DIR:
The location of the R ‘include’ directory. Set by R.
R_LIBS:
Optional. Used for initial setting of[.libPaths](../../base/help/.libPaths.html)
.
R_LIBS_SITE:
Optional. Used for initial setting of[.libPaths](../../base/help/.libPaths.html)
.
R_LIBS_USER:
Optional. Used for initial setting of[.libPaths](../../base/help/.libPaths.html)
.
R_PAPERSIZE:
Optional. Used to set the default for[options](../../base/help/options.html)("papersize")
, e.g. used by[pdf](../../grDevices/html/pdf.html)
and [postscript](../../grDevices/html/postscript.html)
.
R_PCRE_JIT_STACK_MAXSIZE:
Optional. Consulted when PCRE's JIT pattern compiler is first used. See [grep](../../base/help/grep.html)
.
R_PDFVIEWER:
The path to the default PDF viewer. Used by R CMD Rd2pdf
.
R_PLATFORM:
The platform – a string of the form"cpu-vendor-os"
, see [R.Version](../../base/help/R.Version.html)
.
R_PROFILE:
Optional. The path to the site profile file: see Startup. Consulted at startup.
R_RD4PDF:
Options for pdflatex
processing ofRd
files. Used by R CMD Rd2pdf
.
R_SHARE_DIR:
The location of the R ‘share’ directory. Set by R.
R_TEXI2DVICMD:
The path to texi2dvi
. Defaults to the value of TEXI2DVI, and if that is unset to a value determined when R was built.
Only on Unix-alikes:
Consulted at startup to set the default for[options](../../base/help/options.html)("texi2dvi")
, used by[texi2dvi](../../tools/html/texi2dvi.html)
and [texi2pdf](../../tools/html/texi2dvi.html)
in package tools.
R_TIDYCMD:
The path to HTML tidy
. Used byR CMD check
if _R_CHECK_RD_VALIDATE_RD2HTML_ is set to a true value (as it is by --as-cran.
R_UNZIPCMD:
The path to unzip
. Sets the initial value for [options](../../base/help/options.html)("unzip")
on a Unix-alike when namespace utils is loaded.
R_ZIPCMD:
The path to zip
. Used by[zip](../../utils/html/zip.html)
and by R CMD INSTALL --build
on Windows.
TMPDIR, TMP, TEMP:
Consulted (in that order) when setting the temporary directory for the session: see[tempdir](../../base/help/tempdir.html)
. TMPDIR is also used by some of the utilities: see the help for [build](../../utils/html/PkgUtils.html)
.
TZ:
Optional. The current time zone. See[Sys.timezone](../../base/help/Sys.timezone.html)
for the system-specific formats. Consulted as needed.
TZDIR:
Optional. The top-level directory of the time-zone database. See [Sys.timezone](../../base/help/Sys.timezone.html)
.
no_proxy, http_proxy, ftp_proxy:
(and more). Optional. Settings for [download.file](../../utils/html/download.file.html)
: see its help for further details.
Some variables set on Unix-alikes, and not (in general) on Windows.
[Sys.getenv](../../base/help/Sys.getenv.html)
and [Sys.setenv](../../base/help/Sys.setenv.html)
to read and set environmental variables in an R session.