presidential_polls.Rd
Scraped from FiveThirtyEight's website of most recent polls on July 28 2020.
presidential_polls
A tibble with 5312 rows and 37 columns
numeric
numeric
numeric
character
numeric
character
numeric
character
character
numeric
character
character
numeric
character
character
character
character
numeric
logical
Date
Date
Date
character
logical
character
logical
logical
logical
character
character
character
character
numeric
character
character
character
numeric
https://projects.fivethirtyeight.com/polls-page/president_polls.csv
library(ggplot2) library(dplyr) data(presidential_polls) presidential_polls %>% filter(candidate_party %in% c("DEM", "REP")) %>% filter(!is.na(state)) %>% ggplot(aes(x = end_date, y = pct)) + geom_point(aes(colour = candidate_party)) + facet_wrap(~state) + scale_colour_party()# national polls presidential_polls %>% filter(candidate_party %in% c("DEM", "REP")) %>% filter(answer %in% c("Biden", "Trump")) %>% filter(is.na(state)) %>% ggplot(aes(x = end_date, y = pct, colour = candidate_party)) + geom_point(alpha = 0.3) + geom_smooth(se = FALSE, method="gam") + scale_colour_party() + theme(legend.position="bottom")#>