Created
February 20, 2018 21:30
-
-
Save wesslen/b38c938bac06ee6eb173d3c450b70ccc to your computer and use it in GitHub Desktop.
twitter trolls
This file contains hidden or 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(tidyverse); library(lubridate) | |
| url <- "http://nodeassets.nbcnews.com/russian-twitter-trolls/tweets.csv" | |
| tweets <- read_csv(url) | |
| user.url <- "http://nodeassets.nbcnews.com/russian-twitter-trolls/users.csv" | |
| users <- read_csv(user.url) | |
| tweets %>% | |
| count(Date = as.Date(created_str)) %>% | |
| ggplot(aes(x = Date, y = n)) + | |
| geom_line() + | |
| labs(title = "Tweets by Known Twitter Trolls", | |
| x = "Day", | |
| y = "Number of Tweets") | |
| library(tidytext) | |
| top10 <- tweets %>% | |
| count(user_key, sort = TRUE) %>% | |
| head(n = 10) | |
| tweets %>% | |
| filter(user_key %in% top10$user_key) %>% | |
| count(Date = as.Date(created_str), ScreenName = user_key) %>% | |
| ggplot(aes(x = Date, y = n)) + | |
| geom_line() + | |
| facet_wrap(~ScreenName, ncol=2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment