John Mount shows us an example where ...
(the ellipsis) can come back to hurt us:
The following code example contains an easy error in using the Rfunction
unique()
.vec1 <- c("a", "b", "c") vec2 <- c("c", "d") unique(vec1, vec2) # [1] "a" "b" "c"Notice none of the novel values from
vec2
are present in the result. Our mistake was: we (improperly) tried to useunique()
with multiple value arguments, as one would useunion()
. Also notice no error or warning was signaled. We usedunique()
incorrectly and nothing pointed this out to us. What compounded our error wasR
‘s “...
” function signature feature.
John makes it clear that ...
is not itself a bad thing, just that there is a time and a place for it and misusing it can lead to hard-to-understand bugs.