EVOLUTION-MANAGER
Edit File: Sys.getenv.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Get Environment Variables</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for Sys.getenv {base}"><tr><td>Sys.getenv {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Get Environment Variables</h2> <h3>Description</h3> <p><code>Sys.getenv</code> obtains the values of the environment variables. </p> <h3>Usage</h3> <pre> Sys.getenv(x = NULL, unset = "", names = NA) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>a character vector, or <code>NULL</code>.</p> </td></tr> <tr valign="top"><td><code>unset</code></td> <td> <p>a character string.</p> </td></tr> <tr valign="top"><td><code>names</code></td> <td> <p>logical: should the result be named? If <code>NA</code> (the default) single-element results are not named whereas multi-element results are.</p> </td></tr> </table> <h3>Details</h3> <p>Both arguments will be coerced to character if necessary. </p> <p>Setting <code>unset = NA</code> will enable unset variables and those set to the value <code>""</code> to be distinguished, <em>if the OS does</em>. POSIX requires the OS to distinguish, and all known current <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> platforms do. </p> <h3>Value</h3> <p>A vector of the same length as <code>x</code>, with (if <code>names == TRUE</code>) the variable names as its <code>names</code> attribute. Each element holds the value of the environment variable named by the corresponding component of <code>x</code> (or the value of <code>unset</code> if no environment variable with that name was found). </p> <p>On most platforms <code>Sys.getenv()</code> will return a named vector giving the values of all the environment variables, sorted in the current locale. It may be confused by names containing <code>=</code> which some platforms allow but POSIX does not. (Windows is such a platform: there names including <code>=</code> are truncated just before the first <code>=</code>.) </p> <p>When <code>x</code> is missing and <code>names</code> is not false, the result is of class <code>"Dlist"</code> in order to get a nice <code><a href="print.html">print</a></code> method. </p> <h3>See Also</h3> <p><code><a href="Sys.setenv.html">Sys.setenv</a></code>, <code><a href="locales.html">Sys.getlocale</a></code> for the locale in use, <code><a href="getwd.html">getwd</a></code> for the working directory. </p> <p>The help for ‘<a href="EnvVar.html">environment variables</a>’ lists many of the environment variables used by <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span>. </p> <h3>Examples</h3> <pre> ## whether HOST is set will be shell-dependent e.g. Solaris' csh does not. Sys.getenv(c("R_HOME", "R_PAPERSIZE", "R_PRINTCMD", "HOST")) names(s <- Sys.getenv()) # all settings (the values could be very long) head(s, 12)# using the Dlist print() method ## Language and Locale settings -- but rather use Sys.getlocale() s[grep("^L(C|ANG)", names(s))] </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>