[英]Can I have more than one ellipsis in one function
skewness <- function(x, ...){
if(!is.numeric(x))
stop("x is not numeric")
mean((x-mean(x,...)),...)/(var(x,...))^2
}
x <- rnorm(100)
x[3] <- NA
skewness(x,na.rm=T)
[1] NA
I can not get the answer that I want. 我无法获得想要的答案。 So how to use the ellipsis correctly.
那么如何正确使用省略号。 Especially when it comes to more than one ellipsis that I want to use.
尤其是涉及到我要使用的多个省略号时。
You missed one ellipsis and I think there are is one to many (). 您错过了一个省略号,我认为这里有一对多()。
skewness <- function(x, ...){
if(!is.numeric(x))
stop("x is not numeric")
mean(x - mean(x, ...), ...) / (var(x, ...))^2
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.