Created
October 22, 2020 08:38
-
-
Save cndesantana/4319ac725da588bd89cdb990873f6864 to your computer and use it in GitHub Desktop.
Creating a network of tweets and retweets with R
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
| ### Network analysis of tweets and retweets | |
| library(rtweet) | |
| library(tidyverse) | |
| tw <- search_tweets("covid19", n=15000, retryonratelimit = TRUE) | |
| tw %>% filter(is_retweet == TRUE) %>% | |
| mutate(Source = screen_name, Target = retweet_screen_name) %>% | |
| group_by(Target) %>% | |
| mutate(tottarget = n()) %>% | |
| filter(tottarget > 50) %>% | |
| select(Source, Target) %>% | |
| write.csv(file="tweets_network.csv",row.names = FALSE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment