hasArg(methods)
hasArg()所属R语言包:methods
Look for an Argument in the Call
看在呼叫参数
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Returns TRUE if name corresponds to an argument in the call, either a formal argument to the function, or a component of ..., and FALSE otherwise.
返回TRUE如果name对应调用的参数,无论是正式的参数的功能或组件的...,FALSE否则。
用法----------Usage----------
hasArg(name)
参数----------Arguments----------
参数:name
The unquoted name of a potential argument.
一个潜在的参数加引号的名称。
Details
详情----------Details----------
The expression hasArg(x), for example, is similar to !missing(x), with two exceptions. First, hasArg will look for an argument named x in the call if x is not a formal argument to the calling function, but ... is. Second, hasArg never generates an error if given a name as an argument, whereas missing(x) generates an error if x is not a formal argument.
表达式hasArg(x),例如,是类似!missing(x),但有两个例外。首先,hasArg会寻找名为x如果在调用x是不是一个正式的参数调用函数,但...是一个参数。其次,hasArg从来没有产生错误,如果作为一个参数的名称,而missing(x)生成一个错误x如果是不是一个正式的说法。
值----------Value----------
Always TRUE or FALSE as described above.
总是TRUE或FALSE如上面所述。
参见----------See Also----------
missing
missing
举例----------Examples----------
ftest <- function(x1, ...) c(hasArg(x1), hasArg(y2))
ftest(1) ## c(TRUE, FALSE)[#C(为TRUE,FALSE)]
ftest(1, 2) ## c(TRUE, FALSE)[#C(为TRUE,FALSE)]
ftest(y2=2) ## c(FALSE, TRUE)[#C(False或True)]
ftest(y=2) ## c(FALSE, FALSE) (no partial matching)[#C(为FALSE,FALSE)(无部分匹配)]
ftest(y2 = 2, x=1) ## c(TRUE, TRUE) partial match x1[#C(为TRUE,TRUE)部分匹配X1]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|