Sys.setenv sets environment variables (for other processes
called from within R or future calls to
this R process).
Sys.unsetenv removes environment variables.
1 2 3
named arguments with values coercible to a character string.
a character vector, or an object coercible to character.
Non-standard R names must be quoted in
Sys.setenv: see the
examples. Most platforms (and POSIX) do not allow names containing
"=". Windows does, but the facilities provided by R may not
handle these correctly so they should be avoided. Most platforms
allow setting an environment variable to
"", but Windows does
not and there
Sys.setenv(FOO = "") unsets FOO.
There may be system-specific limits on the maximum length of the values of individual environment variables or of names+values of all environment variables.
Recent versions of Windows have a maximum length of 32,767 characters for a
environment variable; however
cmd.exe has a limit of 8192
characters for a command line, hence
set can only set 8188.
A logical vector, with elements being true if (un)setting the
corresponding variable succeeded. (For
includes attempting to remove a non-existent variable.)
On Unix-alikes, if
Sys.unsetenv is not supported, it will at
least try to set the value of the environment variable to
with a warning.
Sys.getenv, Startup for ways to set environment
variables for the R session.
setwd for the working directory.
The help for ‘environment variables’ lists many of the environment variables used by R.
1 2 3 4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.