The three-dots construct in R
There is a mechanism that allows variability in the arguments given to R functions. Technically it is ellipsis, but more commonly called “…”, dots, dot-dot-dot or three-dots.
Basics
The three-dots allows:
- an arbitrary number and variety of arguments
- passing arguments on to other functions
Arbitrary arguments
The two prime cases are the c
and list
functions:
> c function (..., recursive = FALSE) .Primitive("c") > list function (...) .Primitive("list")
Both of these allow you to give them as many arguments as you like, and you can name those arguments (which end up as names in the resulting object). Read more →