You cannot use arguments without a name (edit: ... and missing) in dots and any arguments after dots when these arguments are intended to be matched in an arg list. Position matching, which automatically occurs for unnamed arguments, only "works" in the typical argument processing for named arguments (in the argument list) before points.
> pp1 <- function(x, ...) { length( list(...))} > pp1(1,z=NULL,xx=NULL,1) [1] 3 > pp2 <- function(x, z, ...) { length( list(...))} > pp2(1,z=NULL,xx=NULL,1) [1] 2 > pp3 <- function(x, z, ...) { length( list(...))} > pp3(1, ,xx=NULL,1) [1] 2 > pp <- function(x, ...) { length( list(...))} > pp(1, , xx=NULL, 1) Error in pp(1, , xx = NULL, 1) : argument is missing, with no default
When reading the help page for match.call, the second “commonly used circumstance” is described as:
To pass most of the call to another function, often model.frame. Here the common idiom is that expand.dots = FALSE is used and the element ... of the matching call is removed.
The sequence of argument matching (if not bypassed) is described in Section 4.3.2, “Argument Matching”:
- Coordination of positions. Any unsurpassed formal arguments are tied to the unnamed provided arguments in order. If there is an argument "...", it will accept the remaining arguments, tagged or not.
If any arguments remain inconsistent, an error is declared.