Reputation: 97
I have three variables in one dataframe:
Country <- ("ARG","BR","US","ARG","ARG","BR","CH")
Education_level <- ("HIGH","COLLEGE","KINDER","KINDER","COLLEGE")
Indicator <- (1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,1,1)
I Need to create a pivot or some groupby counting or summarising the values of "Indicator" grouped by Country and Education_level. How can I do that?
Upvotes: 1
Views: 114
Reputation: 886938
We can use xtabs
from base R
xtabs(Indicator ~ Country + Education_level)
Upvotes: 1