match.arg.ext(RSAGA)
match.arg.ext()所属R语言包:RSAGA
Extended Argument Matching
扩展参数匹配
译者:生物统计家园网 机器人LoveR
描述----------Description----------
match.arg.ext matches arg against a set of candidate values as specified by choices; it extends match.arg by allowing arg to be a numeric
match.arg.ext匹配arg对一组指定的候选值choices,延伸match.arg允许arg是一个数字
用法----------Usage----------
match.arg.ext(arg, choices, base = 1, several.ok = FALSE,
numeric = FALSE, ignore.case = FALSE)
参数----------Arguments----------
参数:arg
a character string or numeric value
字符串或数字值
参数:choices
a character vector of candidate values
字符向量的候选值
参数:base
numeric value, specifying the numeric index assigned to the first element of choices
数字值,指定分配给choices的第一个元素的数字索引
参数:several.ok
logical specifying if arg should be allowed to have more than one element
逻辑指定arg如果应该允许有一个以上的元素
参数:numeric
logical specifying if the function should return the numerical index (counting from base) of the matched argument, or, by default, its name
逻辑指定,如果该函数应该返回的数值指标的匹配baseument,或在默认情况下,它的名字(计数从arg)
参数:ignore.case
logical specifying if the matching should be case sensitive
逻辑指定的匹配应该是大小写敏感的
Details
详细信息----------Details----------
When choices are missing, they are obtained from a default setting for the formal argument arg of the function from which match.arg.ext was called.
当choices缺少,他们获得的正式参数arg的功能从match.arg.ext被称为从默认的设置。
Matching is done using pmatch (indirectly through a call to match.arg, so arg may be abbreviated.
进行匹配使用pmatch(间接地通过调用match.arg,这样arg可能是缩写。
If arg is numeric, it may take values between base and length(choices)+base-1. base=1 will give standard 1-based R indices, base=0 will give indices counted from zero
如果arg是数字,它可能需要之间的值base和length(choices)+base-1。 base=1会给基于标准的1 R值,base=0会给指数从零计算
值----------Value----------
If numeric is false and arg is a character string, the function returns the unabbreviated version of the unique partial match of arg if there is one; otherwise, an error is signalled if several.ok is false, as per default. When several.ok is true and there is more than one match, all unabbreviated versions of matches are returned.
numeric如果是假的,arg是一个字符串,该函数返回的未缩写版本的独特部分匹配arg,如果有一个,否则,一个错误的信号,如果several.ok是假的,根据默认的。当several.ok是真实的,有一个以上的比赛,所有的比赛缩写的版本被返回。
If numeric is false but arg is numeric, match.arg.ext returns name of the match corresponding to this index, counting from base; i.e. arg=base corresponds to choices[1].
如果numeric是虚假的,但arg是数字,match.arg.ext返回的匹配对应于索引的名称,计base,即arg=base对应的 X>。
If numeric is true, the function returns the numeric index(es) of the partial match of arg, counted from base to length(choices)+base-1. If arg is already numeric, the function only checks whether it falls into the valid range from arg to length(choices)+base-1 and returns arg.
如果numeric是真实的,该函数返回数字索引(ES)的部分匹配arg,自base到length(choices)+base-1。如果arg已经是数字,则函数只检查是否属于有效范围内arg到length(choices)+base-1和回报arg。
(作者)----------Author(s)----------
Alexander Brenning
参见----------See Also----------
match.arg, pmatch
match.arg,pmatch
实例----------Examples----------
# Based on example from 'match.arg':[基于例如从“match.arg”:]
require(stats)
center <- function(x, type = c("mean", "median", "trimmed")) {
type <- match.arg.ext(type,base=0)
switch(type,
mean = mean(x),
median = median(x),
trimmed = mean(x, trim = .1))
}
x <- rcauchy(10)
center(x, "t") # Works[作品]
center(x, 2) # Same, for base=0[同样,碱基= 0]
center(x, "med") # Works[作品]
center(x, 1) # Same, for base=0[同样,碱基= 0]
try(center(x, "m")) # Error[错误]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|