Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Google Trends is a useful way to compare changes in popularity of certain search terms over time, and Google Trends data can be used as a proxy for all sorts of difficult-to-measure quantities like economic activity and disease propagation. If you'd like to use Google Trends data in your own analyses, the gtrendsR package for R is now available on CRAN. This package by Philippe Massicotte and Dirk Eddelbuettel adds functions to connect with your Google account, and download Trends data for one or more search terms at daily or weekly resolution over a specified period of time.
For example, this code shows the relative prevalence of searches including the terms "data is" and "data are" over the past 10 years:
library(gtrendsR)
user <- "<Google account email>"
psw <- "<Google account password>"
gconnect(usr, psw)
lang_trend <- gtrends(c("data is", "data are"), res="week")
plot(lang_trend)
And here's the resulting plot:
In addition to the trends data (which is only useful to compare with the other terms in your query, and not for absolute popularity), the result object also includes data on the top geographic regions that requested the search terms, and the top complete queries that contained them.
You can install the gtrendsR package from CRAN, or find the latest version on GitHub.
Thinking Inside the Box: gtrends 1.3.0 now on CRAN: Google Trends in R
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.