Skip to content
/ rtweettree Public template

R package to illustrate twitter interactions as tree graphs

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

urswilke/rtweettree

Repository files navigation

rtweettree

R-CMD-check Codecov test coverage Lifecycle: experimental

The goal of rtweettree is to recursively scrape a twitter tweet and all replies, quotes, retweets and likes (that the API provides, see here) and visualize them in a network graph. The functionalities to scrape twitter data are heavily based on the excellent rtweet package. The graph network manipulation functionalities rely on the amazing tidygraph package and are visualized with ggraph.

Responsible use

rtweettree should be used in strict accordance with Twitter’s developer terms.

Installation

To get the current development version from Github (with the remotes package):

## install dev version of rtweettree from github
remotes::install_github("UrsWilke/rtweettree")

Usage

In order to use rtweettree please refer to the according section of rtweet. It is probably good advice to first feel comfortable with rtweet.

Quick dive-in

First we’ll load the package.

library(rtweettree)

This package can first scrape data related to a twitter status id main_status_id (The status id is the last number in the url of every tweet on twitter.) and all the replies (to replies), quotes, retweets and likes the API provides (using rtweet functions under the hood).

main_status_id <- "1438481824922181635"
rtweettree_data_scraped <- rtweettree_data(main_status_id)

This results in a dataframe of rtweet data, which can then be transformed to a tidygraph::tbl_graph() object and finally visualized with ggraph. When you have loaded the rtweettree package, you can also directly use the ggplot2::autoplot() method:

ggplot2::autoplot(rtweettree_data_scraped)

A more in-depth example how to create the subtweet network graph from a tweet status_id is shown in the vignette("get_started").

Getting help

If you encounter a bug, please file an issue with a minimal reproducible example on GitHub.

About

R package to illustrate twitter interactions as tree graphs

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages