R package for downloading Google Ngram Viewer data
- Make sure you have
devtools
installed (install.packages("devtools")
) and loaded (require(devtools)
) - Install using
install_github("jpowerj/ngramdl")
- Then load using
require(ngramdl)
- You can now use
ngram2csv()
to download the data you want: it takes in a list of phrases (first argument) and a filename for the csv (second argument), outputs the csv, and returns the data.frame -- this way you can preview the data right after saving, like:
ngram_data <- ngram2csv(c("phrase1","phrase2"),"ngram_counts.csv")
(c) Jeff Jacobs 2020
http://cs.stanford.edu/~jjacobs3