1

It seems to me a bug for using ... to pass function arugments in R 3.6.3. Specifically, the named arguments will try to partial match the arguments in ..., not exact match. Here's an example:

func1 <- function(varname, ...)
{
  cat(varname, "\n")
}
func1(0, foo = 3)
func1(0, var = 2, foo = 3)
func1(0, var = 1, varn = 2, foo = 3)

The outputs in R 3.6.3 will be:

0
2
Error in func1(0, var = 1, varn = 2, foo = 3) : 
  formal argument "varname" matched by multiple actual arguments
Sam Cao
  • 21
  • 1
  • I don't think this is new behavior. Set `options("warnPartialMatchArgs"=TRUE)` and see that it is doing partial name matches for the second as well, though only erring (due to ambiguity/collision) in the third. This argument has been in R a long time (ref: https://github.com/wch/r-source/blame/d22ee2fc0dc8142b23eed9f46edf76ea9d3ca69a/src/main/options.c#L707, last change to that line of code is in May 2007), suggesting that it has been a "normal thing" to do partial matching for quite a while. (If you keep that option enabled, you'll see some packages appear a little sloppy :-) – r2evans Feb 02 '21 at 11:53

0 Answers0