| Sys.setenv {base} | R Documentation |
Sys.setenv sets environment variables (for other processes
called from within R or future calls to Sys.getenv from
this R process).
Sys.unsetenv removes environment variables.
Sys.setenv(...) Sys.unsetenv(x)
... |
named arguments with values coercible to a character string. |
x |
a character vector, or an object coercible to character. |
The names setenv and putenv come from different Unix
traditions: R also has Sys.putenv, but this is now deprecated.
The internal code uses setenv if available, otherwise putenv.
Non-standard R names must be quoted in Sys.setenv:
see the examples. Most platforms (and POSIX) do not allow names
containing "=".
A logical vector, with elements being true if (un)setting the
corresponding variable succeeded. (For Sys.unsetenv this
includes attempting to remove a non-existent variable.)
Not all systems need support Sys.setenv (although all known
current platforms do) nor Sys.unsetenv.
Sys.getenv, Startup for ways to set environment
variables for the R session.
setwd for the working directory.
print(Sys.setenv(R_TEST="testit", "A+C"=123)) # `A+C` could also be used
Sys.getenv("R_TEST")
try(Sys.unsetenv("R_TEST")) # may not be implemented
Sys.getenv("R_TEST", unset=NA)