Created
July 2, 2019 01:31
-
-
Save JosiahParry/8492b05bf33ea2ac88eab6a76e475553 to your computer and use it in GitHub Desktop.
code for exploring candidate google trends
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(trendyy) | |
library(tidyverse) | |
candidates <- c("joe biden", "kamala harris", "elizabeth warren", "pete buttigieg", "cory booker") | |
candidate_trends <- trendy(candidates, from = "2019-06-15", to = Sys.Date()) | |
get_interest(candidate_trends) %>% | |
filter(date >= "2019-06-25") %>% | |
ggplot(aes(date, hits, color = keyword)) + | |
geom_line() + | |
geom_point() + | |
theme_minimal() + | |
theme(legend.position = "bottom") + | |
labs(title = "Candidate Trends", | |
subtitle = "Before and after first debate night", | |
y = "Relative Interest", | |
x = "") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment