結論
Reduce()
を使うっぽい。
Reduce(function(x, y){ x + y }, c(1,1,1,1,1) ) [1] 5 > Reduce(function(x, y){ x * y }, c(1,2,3,4,5) ) [1] 120
Reduce()
を使うっぽい。
Reduce(function(x, y){ x + y }, c(1,1,1,1,1) ) [1] 5 > Reduce(function(x, y){ x * y }, c(1,2,3,4,5) ) [1] 120