When creating a function in R, we usually specify the number of argument like
function(x,y){ }
That means it takes only two arguments. But
You can use ... to specify an additional number of arguments. For example:
...
myfun <- function(x, ...) { for(i in list(...)) { print(x * i) } } > myfun(4, 3, 1) [1] 12 [1] 4 > myfun(4, 9, 1, 0, 12) [1] 36 [1] 4 [1] 0 [1] 48 > myfun(4)