Twitter “Account Analysis” in R

This past week @propublica linked to a really spiffy resource for getting an overview of a Twitter user’s profile and activity called accountanalysis. It has a beautiful interface that works as well on mobile as it does in a real browser. It also is fully interactive and supports cross-filtering (zoom in on the timeline and the other graphs change). It’s especially great if you’re not a coder, but if you are, @kearneymw’s {rtweet} can get you all this info and more, putting the power of R behind data frames full of tweet inanity.

While we covered quite a bit of {rtweet} ground in the 21 Recipes book, summarizing an account to the degree that accountanalysis does is not in there. To rectify this oversight, I threw together a static clone of accountanalysis that can make standalone HTML reports like this one.twitter account analysis header

It’s a fully parameterized R markdown document, meaning you can run it as just a function call (or change the parameter and knit it by hand):

  input = "account-analysis.Rmd", 
  params = list(
    username = "propublica"
  output_file = "~/Documents/propublica-analysis.html"

It will also, by default, save a date-stamped copy of the user info and retrieved timeline into the directory you generate the report from (add a prefix path to the save portion in the Rmd to store it in a better place).

With all the data available, you can dig in and extract all the information you want/need.


You can get the Rmd at your favorite social coding service:

Cover image from Data-Driven Security
Amazon Author Page

5 Comments Twitter “Account Analysis” in R

  1. Pingback: Twitter “Account Analysis” in R – Data Science Austria

  2. Pingback: توییتر "تحلیل حساب" در R -بی ریل - بی ریل

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.