我正在寻找一种不使用funs()的替代方案(这是作为解决方案here提供的),因为funs()在dplyr 0.8.0版本中已被软淘汰:
mtcars %>% group_by(cyl) %>%
summarize_at(vars(disp, hp), funs(weighted.mean(.,wt)))
# cyl disp hp
# <dbl> <dbl> <dbl>
#1 4.00 110 83.4
#2 6.00 185 122
#3 8.00 362 209 发布于 2020-05-14 21:40:01
正如R警告所说,您必须(在本例中)使用lambda列表
mtcars %>% group_by(cyl) %>%
summarize_at(vars(disp, hp), list(~weighted.mean(., wt)))https://stackoverflow.com/questions/61798715
复制相似问题