有人可以告诉我什么是purrr版本是:
fl <- list(sin, cos, cos, sqrt)
x <- seq(0, 1, length.out = 10)
Reduce(function(f, ...) f(...), fl, x, right = T)
(我对减少和累积的过程尚未成功。)
library(purrr)
lift(compose)(fl)(x)
#> [1] 0.5143953 0.5528477 0.5880842 0.6202147 0.6493739 0.6757146 0.6994011
#> [8] 0.7206037 0.7394947 0.7562439
由Reprex软件包(v0.2.1)在2019-02-19创建
或
compose(!!! fl)(x)