用dplyr总结多列?
df <- data.frame( a = sample(1:5, n, replace = TRUE), b = sample(1:5, n, replace = TRUE), c = sample(1:5, n, replace = TRUE), d = sample(1:5, n, replace = TRUE), grp = sample(1:3, n, replace = TRUE))df %>% group_by(grp) %>% summarise(mean(a))
df %>% group_by(grp) %>% summarise(mean(a))
df %>% group_by(grp) %>% summarise(mean(a:d)) # "mean(a:d)" does not work
蓝山帝景