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
getSymbols("AAPL")
## [1] "AAPL"
getSymbols("MSFT", src="yahoo",from="2025-10-01",to="2026-01-31")
## [1] "MSFT"
plot(MSFT$MSFT.Open, main = "Microsoft (MSFT) Open Prices", ylab = "Open Price", xlab = "Date")
#### Oct 27 - Nov 4
install.packages(“gtrendsR”)
library(gtrendsR)
trends <- gtrends(
keyword = "buy iPhone",
time = "2025-01-01 2025-12-31",
geo = "US"
)
iphone_data <- trends$interest_over_time
iphone_data
## date hits keyword geo time gprop category
## 1 2024-12-29 16 buy iPhone US 2025-01-01 2025-12-31 web 0
## 2 2025-01-05 12 buy iPhone US 2025-01-01 2025-12-31 web 0
## 3 2025-01-12 13 buy iPhone US 2025-01-01 2025-12-31 web 0
## 4 2025-01-19 13 buy iPhone US 2025-01-01 2025-12-31 web 0
## 5 2025-01-26 12 buy iPhone US 2025-01-01 2025-12-31 web 0
## 6 2025-02-02 13 buy iPhone US 2025-01-01 2025-12-31 web 0
## 7 2025-02-09 12 buy iPhone US 2025-01-01 2025-12-31 web 0
## 8 2025-02-16 14 buy iPhone US 2025-01-01 2025-12-31 web 0
## 9 2025-02-23 13 buy iPhone US 2025-01-01 2025-12-31 web 0
## 10 2025-03-02 14 buy iPhone US 2025-01-01 2025-12-31 web 0
## 11 2025-03-09 14 buy iPhone US 2025-01-01 2025-12-31 web 0
## 12 2025-03-16 13 buy iPhone US 2025-01-01 2025-12-31 web 0
## 13 2025-03-23 13 buy iPhone US 2025-01-01 2025-12-31 web 0
## 14 2025-03-30 13 buy iPhone US 2025-01-01 2025-12-31 web 0
## 15 2025-04-06 17 buy iPhone US 2025-01-01 2025-12-31 web 0
## 16 2025-04-13 14 buy iPhone US 2025-01-01 2025-12-31 web 0
## 17 2025-04-20 12 buy iPhone US 2025-01-01 2025-12-31 web 0
## 18 2025-04-27 15 buy iPhone US 2025-01-01 2025-12-31 web 0
## 19 2025-05-04 14 buy iPhone US 2025-01-01 2025-12-31 web 0
## 20 2025-05-11 14 buy iPhone US 2025-01-01 2025-12-31 web 0
## 21 2025-05-18 13 buy iPhone US 2025-01-01 2025-12-31 web 0
## 22 2025-05-25 14 buy iPhone US 2025-01-01 2025-12-31 web 0
## 23 2025-06-01 14 buy iPhone US 2025-01-01 2025-12-31 web 0
## 24 2025-06-08 15 buy iPhone US 2025-01-01 2025-12-31 web 0
## 25 2025-06-15 16 buy iPhone US 2025-01-01 2025-12-31 web 0
## 26 2025-06-22 15 buy iPhone US 2025-01-01 2025-12-31 web 0
## 27 2025-06-29 15 buy iPhone US 2025-01-01 2025-12-31 web 0
## 28 2025-07-06 17 buy iPhone US 2025-01-01 2025-12-31 web 0
## 29 2025-07-13 22 buy iPhone US 2025-01-01 2025-12-31 web 0
## 30 2025-07-20 25 buy iPhone US 2025-01-01 2025-12-31 web 0
## 31 2025-07-27 36 buy iPhone US 2025-01-01 2025-12-31 web 0
## 32 2025-08-03 19 buy iPhone US 2025-01-01 2025-12-31 web 0
## 33 2025-08-10 18 buy iPhone US 2025-01-01 2025-12-31 web 0
## 34 2025-08-17 15 buy iPhone US 2025-01-01 2025-12-31 web 0
## 35 2025-08-24 16 buy iPhone US 2025-01-01 2025-12-31 web 0
## 36 2025-08-31 16 buy iPhone US 2025-01-01 2025-12-31 web 0
## 37 2025-09-07 27 buy iPhone US 2025-01-01 2025-12-31 web 0
## 38 2025-09-14 34 buy iPhone US 2025-01-01 2025-12-31 web 0
## 39 2025-09-21 33 buy iPhone US 2025-01-01 2025-12-31 web 0
## 40 2025-09-28 24 buy iPhone US 2025-01-01 2025-12-31 web 0
## 41 2025-10-05 24 buy iPhone US 2025-01-01 2025-12-31 web 0
## 42 2025-10-12 23 buy iPhone US 2025-01-01 2025-12-31 web 0
## 43 2025-10-19 20 buy iPhone US 2025-01-01 2025-12-31 web 0
## 44 2025-10-26 21 buy iPhone US 2025-01-01 2025-12-31 web 0
## 45 2025-11-02 29 buy iPhone US 2025-01-01 2025-12-31 web 0
## 46 2025-11-09 32 buy iPhone US 2025-01-01 2025-12-31 web 0
## 47 2025-11-16 58 buy iPhone US 2025-01-01 2025-12-31 web 0
## 48 2025-11-23 71 buy iPhone US 2025-01-01 2025-12-31 web 0
## 49 2025-11-30 69 buy iPhone US 2025-01-01 2025-12-31 web 0
## 50 2025-12-07 90 buy iPhone US 2025-01-01 2025-12-31 web 0
## 51 2025-12-14 98 buy iPhone US 2025-01-01 2025-12-31 web 0
## 52 2025-12-21 87 buy iPhone US 2025-01-01 2025-12-31 web 0
## 53 2025-12-28 100 buy iPhone US 2025-01-01 2025-12-31 web 0
plot(iphone_data$date, iphone_data$hits,
type = "l",
main = "When people are most interested in 'Buy iPhone'",
xlab = "2025-01-01 2025-12-31",
ylab = "Amounts of interest" )