Sys.setenv
Set or Unset Environment Variables

Description

Sets or unsets environment variables that are used by other processes called from the engine.

Usage

Sys.setenv(...)
Sys.unsetenv(x)

Arguments

... arguments having the 'name'='value' form, where the 'value' must be coercible to a character string. Depending on the name or value, it might be necessary to quote the name or the value.
x a character vector containing the names of one or more environment variables.

Details

Environment variables set by these functions are in effect during the current session only. They can be retrieved by calling Sys.getenv.
Value
returns a logical vector having the same length as the input, with elements being true if setting or unsetting the corresponding variable succeeded.
Note
Sys.putenv is deprecated. Use Sys.setenv instead.
See Also
Sys.getenv, getwd (and setwd).
Examples
# Set an environment variable using Sys.setenv
ret <- Sys.setenv("S_PRINT_ORIENTATION"="portrait")
ret # TRUE
Sys.getenv("S_PRINT_ORIENTATION")

# Unset a variable using Sys.unsetenv ret <- Sys.unsetenv("S_PRINT_ORIENTATION") ret # TRUE Sys.getenv("S_PRINT_ORIENTATION")

# Unset a non-existing variable in Windows platform. ret <- Sys.unsetenv("S_NOT_EXIST") ret # TRUE Sys.getenv("S_NOT_EXIST") # returns ""

Package base version 6.1.1-7
Package Index