Learn R Programming

JSTORr (version 1.0.20161214)

JSTOR_2bigrams: Plot the frequency of one bigram against bigram over time in a JSTOR DfR dataset

Description

Function to plot changes in the relative frequency of two bigrams over time. The relative frequency is the frequency of the bigram in a document divided by the total number of bigrams in a document. For use with JSTOR's Data for Research datasets (http://dfr.jstor.org/).

Usage

JSTOR_2bigrams(unpack2grams, bigram1, bigram2, span = 0.4)

Arguments

unpack2grams
object returned by the function JSTOR_unpack2grams.
bigram1
two words, surrounded by standard quote marks, or a vector of bigrams.
bigram2
two words, surrounded by standard quote marks, or a vector of bigrams.
span
span of the lowess line (controls the degree of smoothing). Default is 0.4

Value

Returns a ggplot object with publication year on the horizontal axis and log relative frequency on the vertical axis. Each point represents a single document.

Examples

Run this code
## JSTOR_2bigrams(unpack2grams, "pirate booty", "treasure chest")
## JSTOR_2bigrams(unpack2grams, c("treasure chest", "musket balls"), c("jolly roger"), span = 0.2)

Run the code above in your browser using DataLab