Retrieve and Plot Google n-Gram Data

Retrieve and plot word frequencies through time from the "Google Ngram Viewer" <>.


  • Fixed problems with (some) advanced operators
  • Removed debugging from ngrami
  • Fixed the Pulser bug
  • Fix accented character encoding problem on Windows
  • Improve ssl handling (refer Hadley's comment here:

Google has switched to SSL for the N-gram viewer and the format of the web-pages has changed. This means that earlier versions of the package are completely broken. This release fixes this major problem.

  • Add to .Rbuildignore to remove from CRAN
  • Fix count for n-grams with n>1, including a "fudge" for 2012 corpuses
  • Add option to display long-form corpus name
  • Warn about smoothing >0 for geoms other than "line"
  • Tidy documentation for print.ngram
  • ngram and ngrami return S3 class "ngram"
  • Format print for ngram objects
  • ggram can take either a list of phrases or an ngram object
  • Add option to relabel y-axis
  • Add word counts option to ngram
  • Change ggplot2 and scales from Requires to Suggests
  • Prevent use of complex operators in case insensitive searchs
  • Warn about character substitution
  • CRAN release version
  • More efficient handling of escaped Unicode (thanks Hadley
  • Fix package checking problems associated with plyr
  • Tidy Google theme

First semi-offical release. All future development moved to the 'develop' branch.

  • Allow case insensitive plotting with ggram
  • Avoid reshape/reshape2 conflicts (thanks to Francois Briatte)
  • Pass arbitrary geoms to ggram
  • New function ngramw to return results in "wide" format
  • Removed wide option from ggram and ggrami
  • Better handling of legends when ignore_case = TRUE
  • Error trapping long phrase lists
  • Google theme option
  • Added plot wrapper ggram
  • Detect invalid corpus names
  • Initial release of the ngramr package

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.7.4 by Sean Carmody, 7 months ago

Report a bug at

Browse source code at

Authors: Sean Carmody [aut, cre, cph]

Documentation:   PDF Manual  

Task views:

GPL (>= 2) license

Imports httr, rlang, RCurl, dplyr, cli, tibble, tidyr, rjson, stringr, ggplot2, scales, xml2, textutils, lifecycle

Suggests testthat

See at CRAN