Visualise networks of Twitter interactions.
library(htmltools) div( class = "row", div( class = "col-md-3", img( src = "logo.png", alt = "graphTweets", style = "max-height:280px;margin-right:3%;", align = "left" ) ), div( class = "col-md-9", div( class = "row", div( class = "col-md-3", a( class = "btn btn-primary", href = "articles/get_started.html", tags$i(class = "fa fa-rocket"), "Get Started", style = "width:100%" ) ), div( class = "col-md-3", a( class = "btn btn-primary", href = "articles/comentions.html", tags$i(class = "fa fa-object-group"), "Co-mentions", style = "width:100%" ) ), div( class = "col-md-3", a( class = "btn btn-primary", href = "articles/bind.html", tags$i(class = "fa fa-magnet"), "Bind", style = "width:100%" ) ), div( class = "col-md-3", a( class = "btn btn-primary", href = "articles/dynamic.html", tags$i(class = "fa fa-spinner fa-pulse fa-fw"), "Dynamic", style = "width:100%" ) ) ) ) ) br() div( class = "panel panel-default", div( class = "panel-body", div( class = "row", div( class = "col-md-10", "graphTweets is part of the", a("twinetverse,", href = "http://twinetverse.john-coene.com/", target = "_blank"), "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." ), div( class = "col-md-2", a(tags$i(class = "fa fa-book"), "Read", href = "http://twinetbook.john-coene.com/", target = "_blank", class = "btn btn-default", style="width:100%;") ) ), br(), div( class = "row", div( class = "col-md-10", "graphTweets is being used to build all the networks of Chirp." ), div( class = "col-md-2", a(tags$i(class = "fa fa-twitter"), "Visit", href = "https://chirp.sh", target = "_blank", class = "btn btn-default", style="width:100%;") ) ) ) )
install.packages("graphTweets") # CRAN release v0.4 devtools::install_github("JohnCoene/graphTweets") # dev version
gt_edges
& gt_edges_bind
- get edges.gt_co_edges
& gt_co_edges_bind
- get co-mentionsgt_nodes
- get nodes, with or without metadata.gt_dyn
- create dynamic graph.gt_graph
- create igraph
graph object.gt_save
- save the graph to filegt_collect
- collect nodes and edges.gt_add_meta
- Add meta data to nodes (from edges)Functions are meant to be run in a specific order.
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
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.