zipf: Explore Twitter trends with the Storywrangler zipf API

Description Usage Arguments Value Examples

View source: R/storywranglr.R

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:

Usage

1
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

1
2
3
4
5
## Not run: 
# Get top English 2-grams for January 6, 2021
 result <- zipf("2021-01-06", ngrams = 2)

## End(Not run)

storywranglr documentation built on Aug. 13, 2021, 5:08 p.m.