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:
If your question has been answered, don't forget to mark the solution!
How do I mark a solution?
Find the reply you want to mark as the solution and look for the row of small gray icons at the bottom of that reply. Click the one that looks like a box with a checkmark in it:
[image]
Hovering over the mark solution button shows the label, "Select if this reply solves the problem". If you don't see the mark solution button, try clicking the three dots button ( ••• ) to expand the full set of options.
When a solution is chosen, the icon turns green and the hover label changes to: "Unselect if this reply no longer solves the problem". Success!
[solution_reply_author]
…
system
Closed
April 5, 2020, 8:22am
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.