Package Review: gTrendsR
Welcome to #FunDataFriday for gTrendsR
A 3 minute read about a cool data resource.
Today’s #FunDataFriday article is about the R package 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)
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.