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
Question 6
This is the correct code. Jan 31st, 2026 not shown in df due to it
being a Saturday
getSymbols("MSFT", src="yahoo",from = "2025-10-01", to = "2026-02-01")
## [1] "MSFT"
print(MSFT)
## MSFT.Open MSFT.High MSFT.Low MSFT.Close MSFT.Volume MSFT.Adjusted
## 2025-10-01 514.80 520.51 511.69 519.71 22632300 518.7391
## 2025-10-02 517.64 521.60 510.68 515.74 21222900 514.7766
## 2025-10-03 517.10 520.49 515.00 517.35 15112300 516.3835
## 2025-10-06 518.61 531.03 518.20 528.57 21388600 527.5826
## 2025-10-07 528.29 529.80 521.44 523.98 14615200 523.0011
## 2025-10-08 523.28 526.95 523.09 524.85 13363400 523.8695
## 2025-10-09 522.34 524.33 517.40 522.40 18343600 521.4241
## 2025-10-10 519.64 523.58 509.63 510.96 24133800 510.0055
## 2025-10-13 516.41 516.41 511.68 514.05 14284200 513.0897
## 2025-10-14 510.23 515.28 506.00 513.57 14684300 512.6106
## 2025-10-15 514.96 517.19 510.00 513.43 14694700 512.4708
## 2025-10-16 512.58 516.85 508.13 511.61 15559600 510.6542
## 2025-10-17 509.04 515.48 507.31 513.58 19867800 512.6206
## 2025-10-20 514.61 518.70 513.43 516.79 14665600 515.8245
## 2025-10-21 517.50 518.69 513.04 517.66 15586200 516.6929
## 2025-10-22 521.15 525.23 517.71 520.54 18962700 519.5676
## 2025-10-23 522.46 523.95 518.61 520.56 14023500 519.5875
## 2025-10-24 522.79 525.35 520.71 523.61 15532400 522.6318
## 2025-10-27 531.78 534.58 529.01 531.52 18734700 530.5271
## 2025-10-28 550.00 553.72 540.77 542.07 29986700 541.0574
## 2025-10-29 544.94 546.27 536.73 541.55 36023000 540.5383
## 2025-10-30 530.48 534.97 522.12 525.76 41023100 524.7778
## 2025-10-31 528.88 529.32 515.10 517.81 34006400 516.8427
## 2025-11-03 519.81 524.96 514.59 517.03 22374700 516.0641
## 2025-11-04 511.76 515.55 507.84 514.33 20958700 513.3692
## 2025-11-05 513.30 514.83 506.58 507.16 23024300 506.2126
## 2025-11-06 505.66 505.70 495.81 497.10 27406500 496.1714
## 2025-11-07 496.95 499.38 493.25 496.82 24019800 495.8919
## 2025-11-10 500.04 506.85 498.80 506.00 26101500 505.0547
## 2025-11-11 504.80 509.60 502.35 508.68 17980000 507.7297
## 2025-11-12 509.36 511.67 499.12 511.14 26574900 510.1852
## 2025-11-13 510.31 513.50 501.29 503.29 25273100 502.3498
## 2025-11-14 498.23 511.60 497.44 510.18 28505700 509.2269
## 2025-11-17 508.45 512.12 504.91 507.49 19092800 506.5419
## 2025-11-18 495.37 502.98 486.78 493.79 33815100 492.8676
## 2025-11-19 490.10 495.19 482.83 487.12 23245300 486.2100
## 2025-11-20 492.71 493.57 475.50 478.43 26802500 478.4300
## 2025-11-21 478.50 478.92 468.27 472.12 31769200 472.1200
## 2025-11-24 475.00 476.90 468.02 474.00 34421000 474.0000
## 2025-11-25 474.07 479.15 464.89 476.99 28019800 476.9900
## 2025-11-26 486.31 488.31 481.20 485.50 25709100 485.5000
## 2025-11-28 487.60 492.63 486.65 492.01 14386700 492.0100
## 2025-12-01 488.44 489.86 484.65 486.74 23964000 486.7400
## 2025-12-02 486.72 493.50 486.32 490.00 19562700 490.0000
## 2025-12-03 476.32 484.24 475.20 477.73 34615100 477.7300
## 2025-12-04 479.76 481.32 476.49 480.84 22318200 480.8400
## 2025-12-05 482.52 483.40 478.88 483.16 22608700 483.1600
## 2025-12-08 484.89 492.30 484.38 491.02 21965900 491.0200
## 2025-12-09 489.10 492.12 488.50 492.02 14696100 492.0200
## 2025-12-10 484.03 484.25 475.08 478.56 35756200 478.5600
## 2025-12-11 476.63 486.03 475.86 483.47 24669200 483.4700
## 2025-12-12 479.82 482.45 476.34 478.53 21248100 478.5300
## 2025-12-15 480.10 480.72 472.52 474.82 23727700 474.8200
## 2025-12-16 471.91 477.89 470.88 476.39 20705600 476.3900
## 2025-12-17 476.91 480.00 475.00 476.12 24527200 476.1200
## 2025-12-18 478.19 489.60 477.89 483.98 28573500 483.9800
## 2025-12-19 487.36 487.85 482.49 485.92 70836100 485.9200
## 2025-12-22 486.12 488.73 482.69 484.92 16963000 484.9200
## 2025-12-23 484.98 487.83 484.74 486.85 14683600 486.8500
## 2025-12-24 485.68 489.16 484.83 488.02 5855900 488.0200
## 2025-12-26 486.71 488.12 485.96 487.71 8842200 487.7100
## 2025-12-29 484.86 488.35 484.18 487.10 10893400 487.1000
## 2025-12-30 485.93 489.68 485.50 487.48 13944500 487.4800
## 2025-12-31 487.84 488.14 483.30 483.62 15601600 483.6200
## 2026-01-02 484.39 484.66 470.16 472.94 25571600 472.9400
## 2026-01-05 474.06 476.07 469.50 472.85 25250300 472.8500
## 2026-01-06 473.80 478.74 469.75 478.51 23037700 478.5100
## 2026-01-07 479.76 489.70 477.95 483.47 25564200 483.4700
## 2026-01-08 481.24 482.66 475.86 478.11 18162600 478.1100
## 2026-01-09 474.06 479.82 472.20 479.28 18491000 479.2800
## 2026-01-12 476.67 480.99 475.68 477.18 23519900 477.1800
## 2026-01-13 474.68 475.78 465.95 470.67 28545800 470.6700
## 2026-01-14 466.46 468.20 457.17 459.38 28184300 459.3800
## 2026-01-15 464.12 464.25 455.90 456.66 23225800 456.6600
## 2026-01-16 457.83 463.19 456.48 459.86 34246700 459.8600
## 2026-01-20 451.22 456.80 449.28 454.52 26130000 454.5200
## 2026-01-21 452.60 452.69 438.68 444.11 37980500 444.1100
## 2026-01-22 447.62 452.84 444.70 451.14 25349400 451.1400
## 2026-01-23 451.87 471.10 450.53 465.95 38000200 465.9500
## 2026-01-26 465.31 474.25 462.00 470.28 29291200 470.2800
## 2026-01-27 473.70 482.87 473.16 480.58 29213900 480.5800
## 2026-01-28 483.21 483.74 478.00 481.63 36875400 481.6300
## 2026-01-29 439.99 442.50 421.02 433.50 128855300 433.5000
## 2026-01-30 439.17 439.60 426.45 430.29 58566800 430.2900
Question 7
Each row represents one day of stock price. 84 total rows
nrow(MSFT)
## [1] 84
Question 8
Plot demonstrates the highest opening prices between Oct 27 and Nov
4
plot(MSFT$MSFT.Open)
