I have a question, I'm learning to use group_by() and summarise() in the R. But, I stopped at a question in the book I'm studying.
Follow: "How many senators did each party have? Which one had more? Which ones had the least? Tip use: group_by (), summarize () and n_distinct ()"
The data set seems like it's:
I have tried to do like this:
senators <- senado %>% group_by(Party) %>% summarise(num_senators = n_distinct(senado$SenatorUpper))
But, I don't have success.
