gtrendsR Travis-CI Build Status AppVeyor Build Status Package-License CRAN Downloads

gtrendsR provides an interface for retrieving and displaying Google Trends information.

Trends (number of hits) over time as well as geographic representation of the results can be displayed.


In this simple example, trends for keywords nhl, nba and nfl are retrieved and then plotted from R.

usr <- "[email protected]"  # alternatively store as options() or env.var
psw <- "password"        # idem
gconnect(usr, psw)       # stores handle in environment
sport_trend <- gtrends(c("nhl", "nba", "nfl"))
plot(sport_trend)        # data set also included in package

result of sport_trend query

It is also possible to plot geographical data using googleVis as follow.

plot(sport_trend, type = "geo", which = 5)
plot(sport_trend, type = "geo", which = 6)
plot(sport_trend, type = "geo", which = 7)

Should you have trouble connecting, and also use two-factor authentication on your Google Account, then consider creating another Google account (without two-factor authentication) which should allow automated (i.e. programmatic) connection here.


Since release 1.3.0, the package is on CRAN and can be installed via


Pre-release versions can be install directly from this repository via

if (!require("devtools")) install.packages("devtools")


Philippe Massicotte and Dirk Eddelbuettel


GPL (>= 2)

cemigo114/GoogleAPI documentation built on May 12, 2017, 1:16 a.m.