Sys.setenv(...) setenv(which, values) Sys.putenv(...)
values
argument is omitted, a named
vector where the names are those of environment variables to set or modify.
which
.
Each value must be coercible to a character string.
names
attribute that holds the
names of the environment variables.
This returned value can be used to reset any altered environment variables
to their previous values.
setenv
sets the variables given by
which
to the corresponding values in the
values
argument.
If
values
is missing,
which
is expected to have a names attribute giving the names of the variables.
The functions
Sys.setenv
and
Sys.putenv
emulate the R functions
of the same name,
but R's version returns a logical vector having the same length as the
input, with elements being true if setting the corresponding variable succeeded.
For the most portable code, use
Sys.setenv
,
as
Sys.putenv
was declared deprecated in
R 2.5.0.
Environment variables set by these functions are only in effect during this
S-PLUS session and can be retrieved by calling
getenv
or
Sys.getenv
.
# Set an environment variable using Sys.setenv Sys.setenv("S_PRINT_ORIENTATION"="portrait") # Set a variable using setenv orig <- setenv("S_PRINT_ORIENTATION","portrait") # reset to the original value setenv(orig)