This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.
Ref: http://rstudio-pubs-static.s3.amazonaws.com/429204_d8bf19f64be94808820552b05cc614e1.html
In this tutorial, you will learn how to create a series of really cool data visualization that usually appear in the Economist or New York Times.
Google Trends is a very useful service for finding what’s popular among users of the Search engine and generating insights. Trending searches by Google users can be used as an information source that could perhaps improve the forecasts. In Google Trends, Google compiles and aggregates its search data, reflecting the interestin certain keywords or concepts.
In the marketing industry, the volume of queries made by users about the products via the search engine could reflect the potential volume of sales of these products. These data could therefore be considered as indicators of consumer purchase intention, both for manufactured goods and for services.
Using Google Trends manually is fun. However, it could be time-consuming and tedious if you would like to compare different search terms over different time frames.
In this tutorial, I introduce the tool by accessing it directly through a web browser to extract data and analyze it in R. In particular, the main package used will be “gtrendsR” (intro to this package available at https://github.com/PMassicotte/gtrendsR)
Have fun!
This example only features two search queires. Let’s try to do some forecasting before the final result is out. Any thoughts?
install.packages("gtrendsR")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
library(gtrendsR)
midterm <- gtrends(c("blue wave", "red wave"), time = "2022-09-01 2022-11-08",
gprop = "web", geo = c("US"))
plot(midterm)