How to deal with ellipsis (…) in the presence of optional arguments?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a problem with ellipsis when I use optional arguments in my function definition. To clarify, I define following functions: func1 <- function (x) (x-2)^2 func3 <- function (fun, arg.curve.user){ arg.curve.user$expr <- substitute(func1) arg.curve.default <- list(col = "blue", n = 1000, main = "This is a test") arg.curve <- modifyList (arg.curve.default, arg.curve.user) do.call("curve", arg.curve) } # optimizes func1 and call func2 to plot func1 func2 <- function (lb, ub, n.restarts = 5, n.sim = 10, ...){ arg.curve.user <- as.list