Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
即:“将两个参数的函数从左到右累积应用于序列项,以将序列减少为单个值。”
是的,它叫Reduce.
Reduce
一个例子:
Reduce(paste, LETTERS[1:5]) [1] "A B C D E" Reduce(sum, 1:5) [1] 15 #List arguments work the same Reduce(sum, list(1, 2, 3, 4, 5)) [1] 15
有关 R 中函数式编程的更多信息,请参阅 的帮助文件?funprog,它的别名?Reduce
?funprog
?Reduce
是的。见http://stat.ethz.ch/R-manual/R-patched/library/base/html/funprog.html