You cannot use unnamed (edit: ... and missing) arguments in the dots
and any arguments after the dots
when these arguments are intended to be matched in an arg-list. The positional matching that automatically occurs for unnamed arguments only "works" in the typical argument processing for named arguments(in the arg list) before the dots.
> 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
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 matched call is removed.
The sequence of argument matching (when not circumvented) is described in section 4.3.2 "Argument matching":
- Positional matching. Any unmatched formal arguments are bound to unnamed supplied arguments, in order. If there is a ‘...’ argument, it will take up the remaining arguments, tagged or not.
If any arguments remain unmatched an error is declared.