Learn R Programming

JSTORr (version 1.0.20161214)

JSTOR_2wordcor: Plot the change over time of the correlation between one set of words and another set of words in a JSTOR DfR dataset

Description

Function to plot changes in the correlation of two set of words (two sets of 1-grams) over time. For use with JSTOR's Data for Research datasets (http://dfr.jstor.org/).

Usage

JSTOR_2wordcor(unpack1grams, word1, word2, span = 0.4, yearfrom = NULL, yearto = NULL)

Arguments

unpack1grams
object returned by the function JSTOR_unpack1grams.
word1
One word or a vector of words, each word surrounded by standard quote marks.
word2
One word or a vector of words, each word surrounded by standard quote marks.
span
span of the loess line (controls the degree of smoothing). Default is 0.4
yearfrom
year to start the x-axis from, the minimum year to display on the plot
yearto
year to end the x-axis at, the maximum year to display on the plot

Value

Returns a ggplot object with publication year on the horizontal axis and Pearson's correlation on the vertical axis. Each point represents all the documents of a single year, point size is inversely proportional to p-value of the correlation.

Examples

Run this code
## JSTOR_2wordcor(unpack1grams, word1 = "pearls", word2 = "diamonds")
## JSTOR_2wordcor(unpack1grams, c("silver", "gold", "platinum"), c("oil", "gas"), span = 0.3)

Run the code above in your browser using DataLab