knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(twitteRacademic)
The package twitteRacademic is intended for academics who have an academic account on Twitter. This package enables the integration of the Academic Research product track of Twitter, which provides free access to the full-archive search and other V2 endpoints. It provides a feature for circumstantial use of the full-archive search call, which is used to access the historical API. For suggestions, questions, ideas, improvements or reporting bugs, please contact the authors of the package.
More information on twitteRacademic is available on the project homepage.
To be able to use the package in principle, some requirements are to be fulfilled, which are only mentioned here. For an implementation of these please visit the homepages of the infrastructure used here. What you need to have basically set up to use the twitteRacademic package:
For a detailed description of each step to implement an app in Twitter, please visit the pages of the links provided above.
The current/development version of the package can be obtained from the corresponding repository. To install the package directly from GitHub, you can use install_github() from the devtools package:
devtools::install_github("mittendo/twitteRacademic", build_vignettes = TRUE)
For suggestions, questions, ideas, improvements or reporting bugs, please contact the authors of the package [mittendo@uni-wuppertal.de; schmale@uni-wuppertal.de].
# load package library(twitteRacademic) # Replace the bearer token below with your bearer key bearer_token <- "Insert your bearer-token here" # OR # Create .Rprofile data with Your Bearer-Token twitterBearerToken <- "Insert your bearer_token here".#in .Rprofile = twitterBearerToken
# Please check out the different options that Twitter provides for "high-performance" # research/queries. # Query the term you are looking for here query <- '#cducsubt' # Define the starting point of Your research here start <- '2021-03-11T00:00:01Z' # Define the end point of Your research here end <- '2021-03-12T00:00:01Z' # run the query data <- twitter_fas(query, start, end, bearer_token)
Here we use the dataset example:
library(twitteRacademic) library(rtweet) data("cducsuTweets") # show tweets in dataframe tweets <- cducsuTweets$tweets$tweets # plot timerow ts_plot(tweets, "hours") + theme_minimal() + theme(plot.title = element_text(face = "bold")) + labs(x = "Time", y = "Frequency Tweets", caption = "\nSource: Data Collected from Twitter with TwitteRacademic")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.