Skip to content

Instantly share code, notes, and snippets.

@briatte
Last active August 14, 2016 14:14
Show Gist options
  • Save briatte/1dab6997309cf102f9327ebc7d1b2e4b to your computer and use it in GitHub Desktop.
Save briatte/1dab6997309cf102f9327ebc7d1b2e4b to your computer and use it in GitHub Desktop.
# library(devtools)
# install_github("ngramr", "seancarmody")
library(ngramr)
library(ggplot2)
pt <- ngram("process tracing", year_start = 1970)
ql <- ngram("qualitative methods", year_start = 1970)
qt <- ngram("quantitative methods", year_start = 1970)
rm <- ngram("research methods", year_start = 1970)
cs <- ngram("case study methods", year_start = 1970)
cr <- ngram("case study research", year_start = 1970)
ggplot(pt, aes(x = Year, y = Frequency, colour = Phrase)) +
geom_vline(xintercept = c(1991, 2005), lty = "dotted") +
geom_line()
ggsave("pt-1.png", width = 7.5, height = 5)
all <- ngram(c("process tracing",
"qualitative methods",
"quantitative methods",
"research methods",
"case study methods",
"case study research"),
year_start = 1970)
ggplot(all, aes(x = Year, y = Frequency, colour = Phrase)) +
geom_vline(xintercept = c(1991, 2005), lty = "dotted") +
geom_line()
ggsave("pt-2.png", width = 7.5, height = 5)
ggplot(pt, aes(x = Year, y = Frequency, colour = Phrase)) +
geom_vline(xintercept = c(1991, 2005), lty = "dotted") +
geom_line(aes(y = Frequency / ql$Frequency, color = "pt / qual")) +
geom_line(aes(y = Frequency / qt$Frequency, color = "pt / quant")) +
geom_line(aes(y = Frequency / (ql$Frequency + qt$Frequency), color = "pt / qual + quant")) +
geom_line(aes(y = Frequency / rm$Frequency, color = "pt / res. methods"))
ggsave("pt-3.png", width = 7.5, height = 5)
ggplot(pt, aes(x = Year, y = Frequency, colour = Phrase)) +
geom_vline(xintercept = c(1991, 2005), lty = "dotted") +
geom_line(aes(y = Frequency / cs$Frequency, color = "pt / case st methods")) +
geom_line(aes(y = Frequency / cr$Frequency, color = "pt / case st research")) +
geom_line(aes(y = Frequency / (cs$Frequency + cr$Frequency), color = "pt / case st (r + m)"))
ggsave("pt-4.png", width = 7.5, height = 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment