如何编写 compose()
当您使用 compose() 时,函数是从右到左传入的——也就是说,与 base R 中嵌套调用的顺序相同:最先执行的是最右边的函数。
换句话说,如果您习惯用管道,顺序正好相反:
``` r
使用管道
1:28 %>% mean() %>% round()
在 base R 中
round(mean(1:28))
使用 compose
roundedmean <- compose(round, mean) rounded< em>mean(1:28) ```->
那么,怎样写一个用于统计 NA 数量的函数才是正确的呢?
本练习是课程的一部分
