The goal of rtweetstats is to improve accessibility of Twitter analyses for the average R user through two functions; keystats and userstats. The former analyzes user-specified keywords and hashtags, returning an HTML ouput with various summary graphics while the latter analyzes the pages of user-specified Twitter users, returning an HTML output with account summary information as well as the user-specified number of most recent tweets.
Description: This package is compiled of two functions: keystats() and userstats(), both of which return HTML outputs with summary information based on user input. Upon first use of the functions, the user will be asked to authorize a Twitter API token that will continue to be valid and functional following first use. As such, these functions assume that the user has access to a Twitter account of their own. keystats() allows Twitter users to search the website by keyword or hashtag, returning multiple graphics and statistical summaries such as a bar plot of related unique words, a word cloud, a radar chart, and two bar plots of location statistics in an HTML output. userstats() allows Twitter users to search the website by username, allowing the user to search multiple usernames at one time, specify which year they would like summary information for, specify the number of tweets they would like to analyze (with a maximum output allowed of 3,200 tweets), customize the background color of output tables, and customize the text color of the output with the assumption of knowledge of HTML color codes. The output is returned as HTML. Please see the help files of each respective function for documentation of how they may be used and navigated.
You can install this package with the following code:
if(!require(devtools)){
install.packages("devtools")
}
devtools::install_github("annasophiepeters/rtweetstats")
This is a basic example which shows you how to use each of the functions:
library(rtweetstats)
keystats("data science", n=1000, top_num = 20)
userstats(c("taylorswift13","katyperry"), 1000, year = 2019, x=5)