word_frequency: Count the per-year frequency of words

Description Usage Arguments Value Examples

View source: R/words.R

Description

word_frequency provides, for a vector of words, the number of appearances each word made per year in the source texts Wordnik uses.

Usage

1
2
word_frequency(key, words, use_canonical = FALSE, start_year = 1800,
  end_year = 2012, ...)

Arguments

key

a Wordnik API key. These can be obtained at the Wordnik developer portal.

words

a vector of words.

use_canonical

whether to use the stemmed, canonical form of the word (i.e. 'cat', for 'cats') instead of the actual word. FALSE by default. Note that for pronunciations specifically, setting it to TRUE may get a wider range of pronunciations; you should experiment.

start_year

the earliest year to get frequencies for. 1800 (the earliest accepted value) by default.

end_year

the latest year to get frequencies for. 2012 (the latest accepted value) by default.

...

further arguments to pass to httr's GET.

Value

a data.frame of 3 columns; word, year and frequency.

Examples

1
2
3
4
## Not run: 
cats_versus_dogs <- word_frequency(key = "notarealkey", words = c("cat", "dog"))

## End(Not run)

birdnik documentation built on May 27, 2018, 5:04 p.m.