When using ... to capture additional arguments, leaving the last argument empty and attempting to use list(...) will produce an error
f <- function(x, ...) {
args <- list(...)
}
f(x = 0, y = 10,)
> Error in f(x = 0, y = 10, ) : argument is missing, with no default
Here the error message is still informative, but if you pass on the ... you end up with the following
f1 <- function(x, ...) {
f2(x, ...)
}
f2 <- function(x, ...) {
list(...)
}
f1(x = 0, y = 10,)
> Error in f2(x, ...) : argument is missing, with no default
Now it's very it becomes quite unclear what has gone wrong. Are there idiomatic techniques to capture the error and report it with an useful message?