GithubHelp home page GithubHelp logo

urswilke / rtweettree Goto Github PK

View Code? Open in Web Editor NEW
7.0 0.0 0.0 9.73 MB

R package to illustrate twitter interactions as tree graphs

Home Page: https://urswilke.github.io/rtweettree/

License: Other

R 100.00%

rtweettree's Introduction

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.

rtweettree's People

Contributors

urswilke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.