group_by not working.

Hi. I'm trying to do a analysis of the 2016 election according the data from 2016 General Election Polls: Trump vs. Clinton vs. Johnson vs. Stein | RealClearPolling, and in the process I got stuck by using the group_by. Can anyone help please? Thank you in advance!

poll <- subset(poll, select = c("Poll","Date", "Spread"))
poll %>%
separate(Spread, into = c("Candidate", "Lead_Spread"), sep = " ", convert = TRUE, remove = TRUE, fill = "right") %>%
separate(Date, into = c("Start Date", "End Date"), sep = "/") %>%
group_by(Poll, Candidate)

There is no warning or error however the group_by is not getting nothing.

Were you assuming that group_by would have a summarising effect? ... that would require a summarise()
The effect of the group_by that you would see when viewing your tibble in the console is that it would show text at the top announcing what variables it is grouped by.

2 Likes

That makes sense. I just paused once the group_by didn't work. Haven't thought about summarize. Thank you so much!

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.