Twitter is great source of "network data", plus thanks to Michael Kearney's rtweet package the data is extremely easy to access.
The idea is to pull tweets on a specific topic (given a boolean search) and graph the network of Twitter @mentions to visualise hubs of conversations, e.g.: @I tweet @you creates a link between "I" and "you."
We use graphTweets to build the latter. First we pull 15,000 tweets that use the #rstats hashtag.
tweets <- rtweet::search_tweets("#rstats", n = 15000L)
We then use graphTweets to create the network of mentions.
library(graphTweets) net <- tweets %>% gt_edges(screen_name, mentions_screen_name) %>% gt_nodes() %>% gt_collect()
Finally the graph, we tweak the default offline layout so that it spreads out more.
library(grapher) # rename names(net) <- c("links", "nodes") graph(net) %>% graph_offline_layout( steps = 100, gravity = -10 ) %>% scale_node_size(n, c(10, 50)) %>% hide_long_links(180) %>% scale_link_color_coords()