Accessing grouped data in dplyr

后端 未结 2 1355
[愿得一人]
[愿得一人] 2021-01-02 05:00

How can I access the grouped data after applying group_by function from dplyr and using %.% operator

For example, If I want to have the first row of each grouped dat

2条回答
  •  耶瑟儿~
    2021-01-02 05:39

    The only way I found that may help is using the do function.

    library(dplyr)
    
    g.iris <- group_by(x=iris, Species)
    
    do(g.iris, function(x){ head(x, n=1)})
    

提交回复
热议问题