quick/elegant way to construct mean/variance summary table

后端 未结 8 2005
甜味超标
甜味超标 2020-12-13 19:45

I can achieve this task, but I feel like there must be a \"best\" (slickest, most compact, clearest-code, fastest?) way of doing it and have not figured it out so far ...

8条回答
  •  攒了一身酷
    2020-12-13 20:19

    And here is a solution using Hadley Wickham's new dplyr library.

    library(dplyr)
    d %>% group_by(f1, f2, f3) %>% 
    summarise(y.mean = mean(y), z.mean = mean(z))
    

提交回复
热议问题