неопределенное количество аргументов в функции r
myfun <- function(x, ...) {
for(i in list(...)) {
print(x * i)
}
}
d <- function(...){
x <- list(...) # THIS WILL BE A LIST STORING EVERYTHING:
sum(...)
}
# OUTPUT EXAMPLES
> d(1,2,3,4,5)
[1] 15
> myfun(4, 3, 1)
[1] 12
[1] 4
> myfun(4, 9, 1, 0, 12)
[1] 36
[1] 4
[1] 0
[1] 48
> myfun(4)
DeliaBlue