Does a Formal Argument have a Value?
没有一个正式的参数有值吗?
译者:生物统计家园网 机器人LoveR
描述----------Description----------
missing can be used to test whether a value was specified as an argument to a function.
missing可以用来测试是否作为一个函数的参数指定一个值。
用法----------Usage----------
missing(x)
参数----------Arguments----------
参数:x
a formal argument.
一个正式的说法。
Details
详情----------Details----------
missing(x) is only reliable if x has not been altered since entering the function: in particular it will always be false after x <- match.arg(x).
missing(x)是唯一可靠的x尚未改变,因为进入功能,特别是它永远是假后x <- match.arg(x)。
The example shows how a plotting function can be written to work with either a pair of vectors giving x and y coordinates of points to be plotted or a single vector giving y values to be plotted against their indices.
这个例子显示了如何绘制函数可以写成工作,无论是对给点要绘制或给Ÿ值,对他们的指数绘制一个向量x和y坐标向量。
Currently missing can only be used in the immediate body of the function that defines the argument, not in the body of a nested function or a local call. This may change in the future.
目前missing只能被用来在函数定义参数的即时身体,而不是在一个嵌套函数或一个local呼叫的身体。这可能在未来改变。
This is a "special" primitive function: it must not evaluate its argument.
这是一个“特殊”的原始功能:它不能评估其参数。
参考文献----------References----------
The New S Language. Wadsworth & Brooks/Cole.
Programming with Data. A Guide to the S Language. Springer.
参见----------See Also----------
substitute for argument expression; NA for missing values in data.
substitute参数表达式;NA缺少的数据值。
举例----------Examples----------
myplot <- function(x,y) {
if(missing(y)) {
y <- x
x <- 1:length(y)
}
plot(x,y)
}