Sys.getenv(base)
Sys.getenv()所属R语言包:base
Get Environment Variables
获取环境变量
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Sys.getenv obtains the values of the environment variables.
Sys.getenv获取环境变量的值。
用法----------Usage----------
Sys.getenv(x = NULL, unset = "", names = NA)
参数----------Arguments----------
参数:x
a character vector, or NULL.
特征向量,或NULL。
参数:unset
a character string.
一个字符串。
参数:names
logical: should the result be named? If NA (the default) single-element results are not named whereas multi-element results are.
逻辑:应被命名为结果?如果NA(默认)的单元素的结果是多元素,而没有命名的结果。
Details
详情----------Details----------
Both arguments will be coerced to character if necessary.
这两个参数将被强制转换为字符,如果必要的话。
Setting unset = NA will enable unset variables and those set to the value "" to be distinguished, if the OS does. POSIX requires the OS to distinguish, and all known current R platforms do.
设置unset = NA将使未设置变量和那些值""来加以区分,如果操作系统。 POSIX要求操作系统来区分,目前所有已知的R平台。
值----------Value----------
A vector of the same length as x, with (if names == TRUE) the variable names as its names attribute. Each element holds the value of the environment variable named by the corresponding component of x (or the value of unset if no environment variable with that name was found).
x,相同长度的向量(如果names == TRUE)names属性的变量名。每个元素保存x(或价值unset如果被发现没有这个名字的环境变量)。相应的组件命名环境变量的值
On most platforms Sys.getenv() 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 = which some platforms allow but POSIX does not. (Windows is such a platform: there names including = are truncated just before the first =.)
在大多数平台上Sys.getenv()将返回一个命名为向量,让所有环境变量,在当前的语言环境中排序的值。它可能会混淆含有=某些平台允许但POSIX不名。 (Windows是这样一个平台:名称,包括=只是前第一=截断。)
Argument names was introduced in R 2.13.0 to avoid needing the common use of as.vector(Sys.getenv()).
参数names 2.13.0在研发推出,以避免需要as.vector(Sys.getenv())的共同使用。
参见----------See Also----------
Sys.setenv, Sys.getlocale for the locale in use, getwd for the working directory.
Sys.setenv,Sys.getlocale的语言环境中使用,getwd工作目录。
The help for "environment variables" lists many of the environment variables used by R.
“环境变量”列表帮助许多由R.使用的环境变量
举例----------Examples----------
## whether HOST is set will be shell-dependent e.g. Solaris' csh does not.[#是否主机设置将壳依赖如Solaris的CSH没有。]
Sys.getenv(c("R_HOME", "R_PAPERSIZE", "R_PRINTCMD", "HOST"))
names(s <- Sys.getenv()) # all settings (the values could be very long)[所有的设置(值可能很长)]
## Language and Locale settings -- but rather use Sys.getlocale()[#语言和区域设置 - 而是使用Sys.getlocale()]
s[grep("^L(C|ANG)", names(s))]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|