Question 1
No R code required
Question 2
No R code required
You only need to install a package once
Question 3
No R code required
Question 4
No R code required
Question 5
No R code required
Question 6
library(quantmod)
## Loading required package: xts
## Loading required package: zoo
## Warning: package 'zoo' was built under R version 4.5.2
##
## 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(
"MSFT",
src = "yahoo",
from = "2025-10-01",
to = "2026-02-01"
)
## [1] "MSFT"
Question 7
nrow(MSFT)
## [1] 84
Question 8
library(quantmod)
getSymbols("MSFT",
src = "yahoo",
from = "2025-10-01",
to = "2026-02-01")
## [1] "MSFT"
msft_open <- Op(MSFT)
max_open_index <- which.max(msft_open)
max_open_date <- index(MSFT)[max_open_index]
max_open_price <- msft_open[max_open_index]
max_open_date
## [1] "2025-10-28"
max_open_price
## MSFT.Open
## 2025-10-28 550
Question 9
No R code required
Question 10
No R code required