#FunDataFriday - gTrendsR

What is it?

The gtrendsR package is an R package that can be used to programmatically gather and display Google trend information. Lately, I seem to be finding a lot of fun use cases for it, so I figured I would share the joy in my #FunDataFriday series!

Why is it awesome?

It’s an awesome package because it’s so simple! In three lines of code, you can pull Google trend data and visualize the results. Because you get the raw trend data, you can very easily extend your analysis to do almost anything.

How to get started?

Getting started is easy. With just three lines, you can plot your own gTrendsR graph in R.

 
library(gtrendsR)
trends <- gtrends(c("Nerds", "Smarties"), geo ="CA")
plot(trends)

With three more lines, you can make the graph interactive

 
library(plotly)
p <-plot(trends)
ggplotly(p)
 
A gTrendsR graph inspired by  Epi Ellie’s  outrageous competition on the popularity of  Nerds and Smarties!

A gTrendsR graph inspired by Epi Ellie’s outrageous competition on the popularity of Nerds and Smarties!

 

With a little more effort, you can dive into the data or merge it with other sources. If you want to stay on the data visualization path, you can easily exploit the full benefits of ggplot2 to analyze the results! If you want to learn more, I have a few more examples in my recent blog post analyzing the relative popularity of The Bachelor franchise series over time.

r, RLaura EllisR, rComment