{xapir} is an R package that connects to a limited set of X API v2 endpoints using tidy principles.
Package features include:
- OAuth 2.0 authentication by setting your API token as environment variable (Bearer Token)
- Retrieve timeline data using
x_get_timeline()
- Retrieve tweet data using
x_get_tweets()
Installation
# get the development version on GitHub
# install.packages("remotes")
remotes::install_github("Ivey-Business-School/xapir")
# this package is NOT on CRAN so you cannot install using `install.packages()`
If you encounter an issue while using this package, please file a minimal reproducible example on GitHub.
Vignettes
The README below outlines the basic package functionality. For more information please feel free to browse the {xapir} website at https://Ivey-Business-School.github.io/xapir/ which contains the following vignettes:
Usage
Authenticate
First, load the {xapir} package and supply your token.
suppressWarnings(suppressMessages(library(dplyr)))
library(xapir)
token <- Sys.getenv("MY_TOKEN")
After supplying your token, you can begin running functions that call the X APIs.
Future
This package only contains functions that use a subset of the X API endpoints. Future iterations may expand upon this to include more.
More Information
X provides examples in many programming languages, including R by using the package {RTwitterV2}. Please use the X API documentation for more detail around what is expected for each endpoint and the type of data the API call will return. X’s documentation is available here: https://developer.x.com/en/docs/x-api.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.