make.names(base)
make.names()所属R语言包:base
Make Syntactically Valid Names
进行有效语法名称
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Make syntactically valid names out of character vectors.
做出来的特征向量语法的有效名称。
用法----------Usage----------
make.names(names, unique = FALSE, allow_ = TRUE)
参数----------Arguments----------
参数:names
character vector to be coerced to syntactically valid names. This is coerced to character if necessary.
特征向量被裹挟有效语法的名字。如果有必要,这是被迫的字符。
参数:unique
logical; if TRUE, the resulting elements are unique. This may be desired for, e.g., column names.
逻辑;如果TRUE,由此产生的元素是唯一的。这可能是需要的,例如,列名。
参数:allow_
logical. For compatibility with R prior to 1.9.0.
逻辑。与R之前1.9.0的兼容性。
Details
详情----------Details----------
A syntactically valid name consists of letters, numbers and the dot or underline characters and starts with a letter or the dot not followed by a number. Names such as ".2way" are not valid, and neither are the reserved words.
语法有效的名称由字母,数字和点或下划线字符和一个字母或数字不点开始。如".2way"名称不是有效的,既不是保留字。
The definition of a letter depends on the current locale, but only ASCII digits are considered to be digits.
一个字母的定义依赖于当前的语言环境,但只有ASCII数字被认为是数字。
The character "X" is prepended if necessary. All invalid characters are translated to ".". A missing value is translated to "NA". Names which match R keywords have a dot appended to them. Duplicated values are altered by make.unique.
如果有必要的字符"X"前面。所有无效字符均按"."。缺失值被翻译"NA"。名匹配ŕ关键字追加到一个点。重复值是改变make.unique。
值----------Value----------
A character vector of same length as names with each changed to a syntactically valid name, in the current locale's encoding.
一个相同长度的字符向量names每个语法有效的名称改为,在当前语言环境的编码。
注意----------Note----------
Prior to R version 1.9.0, underscores were not valid in variable names, and code that relies on them being converted to dots will no longer work. Use allow_ = FALSE for back-compatibility.
R版本1.9.0之前,底线是无效的变量名,代码依赖于它们被转换成点都将不再起作用。使用allow_ = FALSE向后兼容性。
allow_ = FALSE is also useful when creating names for export to applications which do not allow underline in names (for example, S-PLUS and some DBMSs).
allow_ = FALSE创造出口不允许在名称中的下划线(例如,S-PLUS和某些DBMS)的应用程序的名称时,也非常有用。
参见----------See Also----------
make.unique, names, character, data.frame.
make.unique,names,character,data.frame。
举例----------Examples----------
make.names(c("a and b", "a-and-b"), unique=TRUE)
# "a.and.b" "a.and.b.1"[“a.and.b”,“a.and.b.1”]
make.names(c("a and b", "a_and_b"), unique=TRUE)
# "a.and.b" "a_and_b"[“a.and.b”,“a_and_b”]
make.names(c("a and b", "a_and_b"), unique=TRUE, allow_=FALSE)
# "a.and.b" "a.and.b.1"[“a.and.b”,“a.and.b.1”]
state.name[make.names(state.name) != state.name] # those 10 with a space[其中10个与空间]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|