zipf {storywranglr} | R Documentation |
Explore Twitter trends with the Storywrangler zipf API
Description
Storywrangler's ngrams API lets you search a large historical database of Twitter data for daily usage statistics about strings of one, two, and three words (1-grams, 2-grams, and 3-grams respectively).
This function will query the API for a specific date to return the rank and frequency data for its top n ngrams. Please note that queries of over 1000 ngrams will take a long time to load.
For more details about Storywrangler, please see:
API documentation: https://github.com/janeadams/storywrangler
Academic paper describing uses: https://advances.sciencemag.org/content/7/29/eabe6534.full
Usage
zipf(date, max = 100, language = "en", ngrams = c(1, 2, 3))
Arguments
date |
The date to query, in either character "YYYY-MM-DD" or Date format. |
max |
The maximum number of ngrams to return. Defaults to 100. |
language |
The two-letter code of the language to query. Defaults to "en". |
ngrams |
Integer specifying the type of n-grams to return. Accepts 1, 2, and 3, and defaults to 1. |
Value
A tibble with the API query and response.
Examples
## Not run:
# Get top English 2-grams for January 6, 2021
result <- zipf("2021-01-06", ngrams = 2)
## End(Not run)