Twitter “Account Analysis” in R
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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.
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):
rmarkdown::render( 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.
FIN
You can get the Rmd at your favorite social coding service:
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.