Rev 68948 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/Sys.setenv.Rd% Part of the R package, https://www.R-project.org% Copyright 1995-2011 R Core Team% Distributed under GPL 2 or later\name{Sys.setenv}\alias{Sys.setenv}\alias{Sys.unsetenv}\title{Set or Unset Environment Variables}\usage{Sys.setenv(\dots)Sys.unsetenv(x)}\arguments{\item{\dots}{named arguments with values coercible to a character string.}\item{x}{a character vector, or an object coercible to character.}}\description{\code{Sys.setenv} sets environment variables (for other processescalled from within \R or future calls to \code{\link{Sys.getenv}} fromthis \R process).\code{Sys.unsetenv} removes environment variables.}\value{A logical vector, with elements being true if (un)setting thecorresponding variable succeeded. (For \code{Sys.unsetenv} thisincludes attempting to remove a non-existent variable.)}\details{Non-standard \R names must be quoted in \code{Sys.setenv}: see theexamples. Most platforms (and POSIX) do not allow names containing\code{"="}. Windows does, but the facilities provided by \R may nothandle these correctly so they should be avoided. Most platformsallow setting an environment variable to \code{""}, but Windows doesnot, and there \code{Sys.setenv(FOO = "")} unsets \env{FOO}.There may be system-specific limits on the maximum length of the valuesof individual environment variables or of all environment variables.#ifdef windowsWindows has a limit of 32,767 characters on the environment block, and\code{cmd.exe} has a limit of 2047 (Windows 2000) or 8192 characters(XP and later) for each value.#endif}% http://support.microsoft.com/kb/830473#ifdef unix\note{If \code{Sys.unsetenv} is not supported, it will at least try toset the value of the environment variable to \code{""}, with awarning.}#endif\seealso{\code{\link{Sys.getenv}}, \link{Startup} for ways to set environmentvariables for the \R session.\code{\link{setwd}} for the working directory.The help for \sQuote{\link{environment variables}} lists many of theenvironment variables used by \R.}\examples{print(Sys.setenv(R_TEST = "testit", "A+C" = 123)) # `A+C` could also be usedSys.getenv("R_TEST")#ifdef windowsSys.unsetenv("R_TEST")#endif#ifdef unixSys.unsetenv("R_TEST") # may warn and not succeed#endifSys.getenv("R_TEST", unset = NA)}\keyword{environment}\keyword{utilities}