EnvVar {base} | R Documentation |
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 R uses, 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).
The user's ‘home’ directory.
Optional. The language(s) to be used for message translations. This is consulted when needed.
(etc) Optional. Use to set various aspects of
the locale – see Sys.getlocale
. Consulted at startup.
The path to makeindex
.
If unset to a value determined when R was built.
Used by the emulation mode of texi2dvi
and
texi2pdf
.
Optional – set in a batch session, that is
one started by R CMD BATCH
. Most often set to
""
, so test by something like
!is.na(Sys.getenv("R_BATCH", NA))
.
The path to the default browser. Used to
set the default value of options("browser")
.
Optional. If set to FALSE
,
command-line completion is not used. (Not used by Mac OS GUI.)
A comma-separated list of packages
which are to be attached in every session. See options
.
The location of the R ‘doc’ directory. Set by R.
Optional. The path to the site environment file: see Startup. Consulted at startup.
Optional. The path to Ghostscript, used by
dev2bitmap
, bitmap
and
embedFonts
. Consulted when those functions are
invoked. Since it will be treated as if passed to
system
, spaces and shell metacharacters should be escaped.
Optional. The path of the history file: see Startup. Consulted at startup and when the history is saved.
Optional. The maximum size of the history
file, in lines. Exactly how this is used depends on the
interface.
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
.
The top-level directory of the R
installation: see R.home
. Set by R.
The location of the R ‘include’ directory. Set by R.
Optional. Used for initial setting of
.libPaths
.
Optional. Used for initial setting of
.libPaths
.
Optional. Used for initial setting of
.libPaths
.
Optional. Used to set the default for
options("papersize")
, e.g. used by
pdf
and postscript
.
The path to the default PDF viewer. Used
by R CMD Rd2pdf
.
The platform – a string of the form
cpu-vendor-os
, see R.Version
.
Optional. The path to the site profile file: see Startup. Consulted at startup.
Options for pdflatex
processing of
Rd
files. Used by R CMD Rd2pdf
.
The location of the R ‘share’ directory. Set by R.
The path to texi2dvi
.
Defaults to the value of TEXI2DVI, and if that is unset to a
value determined when R was built.
The path to unzip
. Sets the
initial value for options("unzip")
on a Unix-alike
when namespace utils is loaded.
The path to zip
. Used by
zip
and by R CMD INSTALL --build
on Windows.
Consulted (in that
order) when setting the temporary directory for the session: see
tempdir
. TMPDIR is also used by some of the
utilities see the help for build
.
Optional. The current timezone. See
Sys.timezone
for the system-specific
formats. Consulted as needed.
(and more). Optional. Settings for download.file
:
see its help for further details.
Some Windows-specific variables are
Optional: the path to Ghostscript, used if R_GSCMD is not set.
The user's ‘home’ directory. Set by R. (HOME will be set to the same value if not already set.)
Optional. The top-level directory of the
timezone database. See Sys.timezone
.
Sys.getenv
and Sys.setenv
to read and set
environmental variables in an R session.