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:
3 Comments
Heh, several days ago I’ve made shiny app for that https://shiny.prokulski.science/twitter_user/
hello,
first, thanks for your code. Fantastic!!
I think theres is a problem with the links at the end of the post. They point to https://github.com/hrbrmstr/ggchicklet instead to account-analysis
Thanks again
thx. i’ll update
2 Trackbacks/Pingbacks
[…] by data_admin [This article was first published on R – rud.is, and kindly contributed to R-bloggers]. (You can report issue about the content on this page […]
[…] article was first published on R – rud.is, and kindly contributed to R-bloggers]. (شما می توانید مشکل در مورد […]