Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

Sys.setenv: Set or Unset Environment Variables

Sys.setenvR Documentation

Set or Unset Environment Variables

Description

Sys.setenv sets environment variables (for other processescalled from withinR or future calls toSys.getenv fromthisR process).

Sys.unsetenv removes environment variables.

Usage

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

Arguments

...

named arguments with values coercible to a character string.

x

a character vector, or an object coercible to character.

Details

Non-standardR names must be quoted inSys.setenv: see theexamples. Most platforms (and POSIX) do not allow names containing"=". Windows does, but the facilities provided byR may nothandle these correctly so they should be avoided. Most platformsallow setting an environment variable to"", but Windows doesnot and thereSys.setenv(FOO = "") unsetsFOO.

There may be system-specific limits on the maximum length of thevalues of individual environment variables or of names+values of allenvironment variables.

Recent versions of Windows have a maximum length of 32,767 characters for aenvironment variable; howevercmd.exe has a limit of 8192characters for a command line, henceset can only set 8188.

Value

A logical vector, with elements being true if (un)setting thecorresponding variable succeeded. (ForSys.unsetenv thisincludes attempting to remove a non-existent variable.)

Note

On Unix-alikes, ifSys.unsetenv is not supported, it will atleast try to set the value of the environment variable to"",with a warning.

See Also

Sys.getenv, Startup for ways to set environmentvariables for theR session.

setwd for the working directory.

The help for ‘environment variables’ lists many of theenvironment variables used byR.

Examples

print(Sys.setenv(R_TEST = "testit", "A+C" = 123))  # `A+C` could also be usedSys.getenv("R_TEST")Sys.unsetenv("R_TEST") # on Unix-alike may warn and not succeedSys.getenv("R_TEST", unset = NA)

What can we improve?

R Package Documentation

Browse R Packages

We want your feedback!

Note that we can't provide technical support on individual packages. You should contact the package authors for that.

 
Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, readEmbedding Snippets.

Close

[8]ページ先頭

©2009-2025 Movatter.jp