Visualise networks of Twitter interactions.


graphTweets is part of the twinetverse, a set of packages for Twitter network analysis and visualisation, which comes with a book in which you will find even more use cases of sigmajs.

graphTweets is being used to build all the networks of Chirp.

Install

install.packages("graphTweets") # CRAN release v0.4
devtools::install_github("JohnCoene/graphTweets") # dev version

Functions

  • gt_edges & gt_edges_bind - get edges.
  • gt_co_edges & gt_co_edges_bind - get co-mentions
  • gt_nodes - get nodes, with or without metadata.
  • gt_dyn - create dynamic graph.
  • gt_graph - create igraph graph object.
  • gt_save - save the graph to file
  • gt_collect - collect nodes and edges.
  • gt_add_meta - Add meta data to nodes (from edges)

Rationale

Functions are meant to be run in a specific order.

  1. Extract edges
  2. Extract the nodes

One can only know the nodes of a network based on the edges, so run them in that order. However, you can build a graph based on edges alone:

library(igraph) # for plot

tweets <- rtweet::search_tweets("rstats")

tweets %>% 
  gt_edges(text, screen_name, status_id) %>% 
  gt_graph() %>% 
  plot()

This is useful if you are building a large graph and don’t need any meta data on the nodes (other than those you can compute from the graph, i.e.: degree like in the example above). If you need meta data on the nodes use gt_nodes.