Grouping in R by Cells

2580 views r
-2

I am trying to group data in R by Education-Experience-Year cells. My search led me to the dplyr package, and I can use code like this

by_EdExpT <- df1 %>% group_by(ED, EXP, YEAR)

to group the data. But I'm not really sure how to perform operations on it. Is dplyr the best package to use for this, and how do I perform operations like means or regressions?

answered question

1 Answer

8

It really depends on what you mean by perform operations. You can use the summarise() function from dplyr to compute means by group, for example. It'll work for anything that produces one output per group.

summarise(by_EdExpT, mean)

If you want some overview of dplyr functionalities you can use the cheatsheet to check it out.

posted this

Have an answer?

JD

Please login first before posting an answer.