R Markdown

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. You can embed an R code chunk like this:

install.packages("gtrendsR")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.5'
## (as 'lib' is unspecified)
library(gtrendsR)
midterm <- gtrends(c("blue wave", "red wave"), 
                   gprop = "web", geo = c("US"))
plot(midterm)
## Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
## ℹ Please use tidy evaluation idioms with `aes()`.
## ℹ See also `vignette("ggplot2-in-packages")` for more information.
## ℹ The deprecated feature was likely used in the gtrendsR package.
##   Please report the issue at <https://github.com/PMassicotte/gtrendsR/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

library(gtrendsR)
stock_trends <- gtrends(c("AMAZON", "TESLA"), 
                   gprop = "web", geo = c("US"))
plot(stock_trends)

install.packages("quantmod")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.5'
## (as 'lib' is unspecified)
install.packages("lubridate")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.5'
## (as 'lib' is unspecified)
library(quantmod)
## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Loading required package: TTR
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
library(lubridate)
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
getSymbols('AMZN', src = 'yahoo', 
           from = Sys.Date() - years(4), to = Sys.Date())
## [1] "AMZN"
getSymbols('TSLA', src = 'yahoo', 
           from = Sys.Date() - years(4), to = Sys.Date())
## [1] "TSLA"
stocks <- as.xts(data.frame(AMZN = AMZN$"AMZN.Close",
                            TSLA = TSLA$"TSLA.Close"))

plot(as.zoo(stocks),screens = 1,lty = c(1,3),
     col = c("red","blue") ,xlab = "date",ylab = "Price")
legend("top",c("AMZN","TSLA"),
       lty = c(1,3),col = c("red","blue"),cex = 0.5)

Responses

  1. Search Interest Trends:

What do the plotted Google Trends data for Tesla and Amazon reveal about the relative search interest over the specified time period? Are there any significant fluctuations or patterns that stand out? ### Responses

xyz

Seasonal Patterns:

Do you observe any recurring seasonal patterns in the search interest for Tesla and Amazon? Are there specific times of the year when search interest tends to peak or dip for these keywords?

Responses

xyz