래퍼 함수가 있는데 여기에 지정된 하위 함수에 선택적 인수를 전달해야합니다. 그러나 내가 미리 지정할 수없는 여러 가지 가능한 하위 기능이 있습니다. 참고로 은 하위 기능은 환경 등에 존재 ... 고려 :래퍼 함수 내에서 선택적 인수를 하위 함수로 전달
funInFun<- function (x, method, ...) {
method.out <- function(this.x, FUN, ...) {
FUN <- match.fun(FUN)
c <- FUN(this.x, ...)
return(c)
}
d <- method.out(x, method)
return(d)
}
data<-seq(1,10)
funInFun(data, mean) # Works
data<-c(NA,seq(1,10))
funInFun(data, mean, na.rm=TRUE) # Should remove the NA
funInFun(c(seq(1,10)), quantile, probs=c(.3, .6)) # Shoudl respect the probs option.
니스. 고마워요 토마스. –