Loading required packages…
Error in library(Quandl) : there is no package called ‘Quandl’
We’ll create a directory for storing competitive intelligence data
'C:\Users\KEVIN\Downloads\mds-master\MDS_Chapter_12\ci_data' already exists
Retrieving Spirit Airlines stock price data (SAVE):
[1] "SAVE"
[1] "SAVE"
An ‘xts’ object on 2011-05-26/2017-02-08 containing:
Data: num [1:1436, 1:6] 11.3 11.5 11.6 11.7 11.5 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:6] "SAVE.Open" "SAVE.High" "SAVE.Low" "SAVE.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
$ src : chr "yahoo"
$ updated: POSIXct[1:1], format: "2017-02-09 03:15:05"
NULL
Plot the series stock price
Examining the structure of the R data object
An ‘xts’ object on 2011-05-26/2017-02-08 containing:
Data: num [1:1436, 1:6] 11.3 11.5 11.6 11.7 11.5 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:6] "SAVE.Open" "SAVE.High" "SAVE.Low" "SAVE.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
$ src : chr "yahoo"
$ updated: POSIXct[1:1], format: "2017-02-09 03:15:05"
NULL
Examine SAVE historical prices
SAVE.Open SAVE.High SAVE.Low SAVE.Close SAVE.Volume SAVE.Adjusted
2011-05-26 11.35 11.68 11.11 11.55 6394800 11.55
2011-05-27 11.50 11.60 11.35 11.48 728600 11.48
2011-05-31 11.57 11.90 11.45 11.80 824400 11.80
2011-06-01 11.68 11.79 11.57 11.59 521700 11.59
2011-06-02 11.52 12.00 11.48 11.90 497000 11.90
2011-06-03 11.76 12.00 11.55 11.96 427100 11.96
2011-06-06 11.82 12.10 11.76 11.99 851900 11.99
2011-06-07 12.09 12.20 11.73 12.02 348000 12.02
2011-06-08 12.13 12.20 11.90 12.09 412500 12.09
2011-06-09 12.16 12.20 11.95 12.17 186500 12.17
2011-06-10 12.20 12.20 11.66 12.04 371300 12.04
2011-06-13 11.96 12.17 11.85 12.03 259100 12.03
2011-06-14 12.10 12.17 11.94 12.00 136500 12.00
2011-06-15 11.97 12.08 11.61 12.00 197700 12.00
2011-06-16 11.92 12.00 11.75 11.89 210800 11.89
2011-06-17 12.00 12.00 11.77 11.90 371400 11.90
2011-06-20 11.93 12.00 11.75 12.00 181200 12.00
2011-06-21 12.00 12.11 11.90 12.05 269800 12.05
2011-06-22 12.13 12.13 11.92 12.03 399300 12.03
2011-06-23 11.93 12.05 11.80 12.05 352700 12.05
2011-06-24 12.01 12.10 11.54 12.00 3030800 12.00
2011-06-27 11.87 12.00 11.74 12.00 408500 12.00
2011-06-28 11.74 12.31 11.74 12.30 622400 12.30
2011-06-29 12.27 12.33 11.95 12.26 428900 12.26
2011-06-30 12.21 12.21 11.77 11.99 244000 11.99
2011-07-01 12.08 12.47 12.04 12.40 314700 12.40
2011-07-05 12.56 12.69 12.05 12.15 331500 12.15
2011-07-06 12.26 13.36 12.26 13.17 1138000 13.17
2011-07-07 13.21 13.31 12.71 12.90 476000 12.90
2011-07-08 12.70 13.90 12.56 13.71 402600 13.71
2011-07-11 13.64 13.64 13.01 13.41 324400 13.41
2011-07-12 13.29 14.24 13.29 13.54 379900 13.54
2011-07-13 13.57 14.14 13.48 14.09 243200 14.09
2011-07-14 14.06 14.43 13.90 14.29 275700 14.29
2011-07-15 14.28 14.43 13.88 14.23 151300 14.23
2011-07-18 14.17 14.17 13.54 13.66 119800 13.66
2011-07-19 13.67 14.07 13.67 14.00 347400 14.00
2011-07-20 14.00 14.00 13.26 13.39 114200 13.39
2011-07-21 13.39 13.89 13.06 13.80 140300 13.80
2011-07-22 13.83 13.83 12.82 13.52 167600 13.52
2011-07-25 13.47 13.47 12.80 13.14 107800 13.14
2011-07-26 12.99 13.10 12.33 12.77 226500 12.77
2011-07-27 12.75 12.76 12.01 12.64 184000 12.64
2011-07-28 14.00 14.00 13.05 13.24 602400 13.24
2011-07-29 13.04 13.27 12.51 13.10 144700 13.10
2011-08-01 13.34 13.37 13.00 13.03 154500 13.03
2011-08-02 12.86 13.30 12.75 12.94 214100 12.94
2011-08-03 12.90 13.30 12.60 13.24 307600 13.24
2011-08-04 12.65 13.65 12.39 12.61 236100 12.61
2011-08-05 12.72 13.35 12.02 12.61 231900 12.61
2011-08-08 12.22 12.40 11.24 11.31 338800 11.31
2011-08-09 11.58 11.90 11.06 11.61 250800 11.61
2011-08-10 11.45 12.00 10.81 10.98 220400 10.98
2011-08-11 11.24 12.05 11.08 11.92 193800 11.92
2011-08-12 11.98 12.41 11.32 11.62 131900 11.62
2011-08-15 11.74 12.18 11.48 12.09 68200 12.09
2011-08-16 12.00 12.51 11.51 12.13 105700 12.13
2011-08-17 12.21 12.40 11.18 12.11 100300 12.11
2011-08-18 11.85 11.85 10.87 11.01 268600 11.01
2011-08-19 10.85 11.09 10.25 10.55 318400 10.55
2011-08-22 10.76 10.96 10.18 10.44 408600 10.44
2011-08-23 10.50 11.66 10.50 11.64 253100 11.64
2011-08-24 11.57 11.95 10.84 11.91 160000 11.91
2011-08-25 11.94 11.97 11.27 11.57 102600 11.57
2011-08-26 11.54 12.15 11.40 12.14 94900 12.14
2011-08-29 12.24 12.67 12.24 12.44 83000 12.44
2011-08-30 12.33 12.88 12.00 12.07 92300 12.07
2011-08-31 12.15 12.23 11.73 12.08 105000 12.08
2011-09-01 12.12 12.55 11.90 11.95 138400 11.95
2011-09-02 11.73 11.81 11.39 11.74 94600 11.74
2011-09-06 11.39 12.16 11.39 11.67 90100 11.67
2011-09-07 11.85 12.16 11.73 11.88 89100 11.88
2011-09-08 11.80 11.83 11.47 11.49 52600 11.49
2011-09-09 11.40 11.56 11.23 11.37 69500 11.37
2011-09-12 11.21 11.57 11.07 11.16 80200 11.16
2011-09-13 11.21 11.58 11.08 11.46 143400 11.46
2011-09-14 11.47 12.41 11.26 12.41 147700 12.41
2011-09-15 12.40 12.86 11.84 12.77 135500 12.77
2011-09-16 12.84 12.85 12.41 12.77 226300 12.77
2011-09-19 12.60 12.60 12.19 12.55 53100 12.55
2011-09-20 12.61 12.61 11.86 11.95 89700 11.95
2011-09-21 11.84 12.24 11.52 11.57 182500 11.57
2011-09-22 11.27 11.68 10.73 11.24 267000 11.24
2011-09-23 11.31 11.73 10.88 11.63 54100 11.63
2011-09-26 11.65 11.91 11.07 11.88 81400 11.88
2011-09-27 12.06 12.63 11.77 12.20 111200 12.20
2011-09-28 12.16 12.32 11.83 12.13 84200 12.13
2011-09-29 12.40 12.75 12.00 12.73 105500 12.73
2011-09-30 12.58 12.73 12.14 12.50 83600 12.50
2011-10-03 12.34 12.34 11.42 11.70 178100 11.70
2011-10-04 11.67 12.47 11.45 12.43 180000 12.43
2011-10-05 12.46 12.83 11.87 12.73 76300 12.73
2011-10-06 12.70 13.26 12.46 13.14 105300 13.14
2011-10-07 13.19 13.80 12.86 13.10 127700 13.10
2011-10-10 13.33 13.44 12.99 13.43 92300 13.43
2011-10-11 13.31 14.20 13.09 13.71 140200 13.71
2011-10-12 13.89 14.54 13.70 14.52 109900 14.52
2011-10-13 15.14 16.27 15.14 15.90 392500 15.90
2011-10-14 16.03 16.09 15.53 15.63 120000 15.63
2011-10-17 15.57 15.89 14.62 14.82 114700 14.82
2011-10-18 14.87 15.38 14.39 14.91 96300 14.91
2011-10-19 14.86 15.00 14.18 14.49 78000 14.49
2011-10-20 14.53 14.91 14.05 14.19 83700 14.19
2011-10-21 14.43 14.98 13.80 14.93 95500 14.93
2011-10-24 14.95 15.90 14.84 15.87 105200 15.87
2011-10-25 15.76 15.80 14.96 15.03 60500 15.03
2011-10-26 15.26 15.85 14.40 15.21 142800 15.21
2011-10-27 16.00 16.55 15.30 16.21 346600 16.21
2011-10-28 16.50 16.98 15.88 16.51 257300 16.51
2011-10-31 16.38 17.21 15.97 16.46 103600 16.46
2011-11-01 16.03 16.18 15.30 15.37 93000 15.37
2011-11-02 15.48 16.49 15.12 15.73 175900 15.73
2011-11-03 16.01 16.94 15.56 16.41 160700 16.41
2011-11-04 16.30 16.40 15.91 16.20 69800 16.20
2011-11-07 16.20 16.70 15.72 16.46 72400 16.46
2011-11-08 16.59 16.59 15.76 16.40 99100 16.40
2011-11-09 15.94 16.50 14.60 15.45 238800 15.45
2011-11-10 15.59 15.74 14.31 15.71 196500 15.71
2011-11-11 15.81 16.25 15.72 16.19 146300 16.19
2011-11-14 16.18 17.24 16.17 16.91 168500 16.91
2011-11-15 16.86 17.02 16.49 16.74 146100 16.74
2011-11-16 16.66 17.48 16.50 16.58 323200 16.58
2011-11-17 16.59 16.74 15.76 16.03 176400 16.03
2011-11-18 16.06 16.58 15.41 15.95 138700 15.95
2011-11-21 15.68 16.60 15.31 16.49 243000 16.49
2011-11-22 16.48 16.75 16.11 16.54 423100 16.54
2011-11-23 16.39 16.52 16.16 16.36 327300 16.36
2011-11-25 16.33 16.59 16.25 16.31 149800 16.31
2011-11-28 16.76 17.25 16.65 17.03 264600 17.03
2011-11-29 17.05 17.22 15.73 16.11 419200 16.11
2011-11-30 16.74 16.74 16.07 16.13 1215000 16.13
2011-12-01 15.79 16.27 15.33 16.03 283800 16.03
2011-12-02 16.29 16.63 16.00 16.20 204800 16.20
2011-12-05 16.49 16.99 16.01 16.18 255400 16.18
2011-12-06 15.90 15.90 14.67 15.37 535000 15.37
2011-12-07 15.31 16.15 15.27 16.00 331900 16.00
2011-12-08 15.56 15.90 15.35 15.66 217200 15.66
2011-12-09 15.73 15.97 15.37 15.81 110200 15.81
2011-12-12 15.47 15.88 15.47 15.79 105600 15.79
2011-12-13 15.73 15.78 15.16 15.24 127800 15.24
2011-12-14 15.13 15.47 14.99 15.45 167100 15.45
2011-12-15 15.59 15.80 15.44 15.57 286000 15.57
2011-12-16 15.60 15.60 15.08 15.33 284700 15.33
2011-12-19 15.40 15.49 15.10 15.25 166700 15.25
2011-12-20 15.45 15.66 15.32 15.44 111400 15.44
2011-12-21 15.42 15.64 15.20 15.52 149100 15.52
2011-12-22 15.64 16.00 15.64 15.78 283600 15.78
2011-12-23 15.86 15.86 15.61 15.69 128900 15.69
2011-12-27 15.59 15.78 15.32 15.69 112700 15.69
2011-12-28 15.63 15.63 15.23 15.28 47300 15.28
2011-12-29 15.33 15.50 15.25 15.38 44300 15.38
2011-12-30 15.35 15.67 15.02 15.60 107900 15.60
2012-01-03 15.70 15.70 14.90 15.07 201100 15.07
2012-01-04 14.95 15.12 14.44 14.62 175100 14.62
2012-01-05 14.48 14.61 14.15 14.46 144700 14.46
2012-01-06 14.41 14.65 14.34 14.58 86200 14.58
2012-01-09 14.65 15.06 14.56 14.93 148700 14.93
2012-01-10 15.11 15.23 14.81 14.99 327500 14.99
2012-01-11 15.01 15.60 15.01 15.49 163700 15.49
2012-01-12 15.57 15.57 15.05 15.16 107100 15.16
2012-01-13 15.05 15.31 14.90 15.02 90000 15.02
2012-01-17 14.20 14.59 14.05 14.19 475300 14.19
2012-01-18 14.21 14.50 13.90 14.48 483100 14.48
2012-01-19 14.36 14.72 14.00 14.67 829800 14.67
2012-01-20 15.19 15.60 15.06 15.54 6734100 15.54
2012-01-23 15.51 15.90 15.43 15.80 730100 15.80
[ reached getOption("max.print") -- omitted 1270 rows ]
Retreives Spirit Airlines stock price data from GOOGLE
[1] "SAVE"
Show the structure of this xtx time series object
An ‘xts’ object on 2011-05-26/2017-02-08 containing:
Data: num [1:1436, 1:5] 11.3 11.5 11.6 11.7 11.5 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "SAVE.Open" "SAVE.High" "SAVE.Low" "SAVE.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
$ src : chr "google"
$ updated: POSIXct[1:1], format: "2017-02-09 03:16:27"
NULL
Plot the series stock price:
Examining the structure of the R data object
An ‘xts’ object on 2011-05-26/2017-02-08 containing:
Data: num [1:1436, 1:5] 11.3 11.5 11.6 11.7 11.5 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "SAVE.Open" "SAVE.High" "SAVE.Low" "SAVE.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
$ src : chr "google"
$ updated: POSIXct[1:1], format: "2017-02-09 03:17:02"
NULL
Examine historical data for SAVE
SAVE.Open SAVE.High SAVE.Low SAVE.Close SAVE.Volume
2011-05-26 11.35 11.68 11.11 11.55 6394749
2011-05-27 11.50 11.60 11.35 11.48 728574
2011-05-31 11.57 11.90 11.45 11.80 824333
2011-06-01 11.68 11.79 11.57 11.59 521608
2011-06-02 11.52 12.00 11.48 11.90 496963
2011-06-03 11.76 12.00 11.55 11.96 427060
2011-06-06 11.81 12.10 11.76 11.99 851870
2011-06-07 12.09 12.20 11.73 12.02 347930
2011-06-08 12.13 12.20 11.90 12.09 412497
2011-06-09 12.16 12.20 11.95 12.17 186423
2011-06-10 12.20 12.20 11.66 12.04 371260
2011-06-13 11.96 12.17 11.85 12.03 259065
2011-06-14 12.10 12.17 11.94 12.00 136424
2011-06-15 11.97 12.08 11.61 12.00 197656
2011-06-16 11.92 12.00 11.75 11.89 210797
2011-06-17 12.00 12.00 11.77 11.90 371378
2011-06-20 11.93 12.00 11.75 12.00 181171
2011-06-21 12.00 12.11 11.90 12.05 269704
2011-06-22 12.13 12.13 11.92 12.03 399234
2011-06-23 11.93 12.05 11.80 12.05 352657
2011-06-24 12.01 12.10 11.54 12.00 3031153
2011-06-27 11.87 12.00 11.74 12.00 408498
2011-06-28 11.74 12.31 11.74 12.30 622330
2011-06-29 12.27 12.33 11.95 12.26 428815
2011-06-30 12.21 12.21 11.77 11.99 244470
2011-07-01 12.08 12.47 12.04 12.40 314656
2011-07-05 12.56 12.69 12.05 12.15 331423
2011-07-06 12.26 13.36 12.26 13.17 1137933
2011-07-07 13.21 13.31 12.71 12.90 475917
2011-07-08 12.70 13.90 12.56 13.71 402579
2011-07-11 13.64 13.64 13.01 13.41 324326
2011-07-12 13.29 14.24 13.29 13.54 379806
2011-07-13 13.57 14.14 13.48 14.09 243139
2011-07-14 14.06 14.43 13.90 14.29 275715
2011-07-15 14.28 14.43 13.88 14.23 151221
2011-07-18 14.17 14.17 13.54 13.66 119787
2011-07-19 13.67 14.07 13.67 14.00 347372
2011-07-20 14.00 14.00 13.26 13.39 114201
2011-07-21 13.39 13.89 13.06 13.80 140292
2011-07-22 13.83 13.83 12.82 13.52 167537
2011-07-25 13.47 13.47 12.80 13.14 107744
2011-07-26 12.99 13.10 12.33 12.77 226499
2011-07-27 12.75 12.76 12.01 12.64 186816
2011-07-28 14.00 14.00 13.05 13.24 602390
2011-07-29 13.04 13.27 12.51 13.10 144610
2011-08-01 13.34 13.37 13.00 13.03 154476
2011-08-02 12.86 13.16 12.60 13.01 303158
2011-08-03 13.08 13.30 12.60 13.24 307582
2011-08-04 12.65 13.65 12.39 12.61 236052
2011-08-05 12.72 13.35 12.02 12.61 231829
2011-08-08 12.22 12.40 11.24 11.31 338841
2011-08-09 11.58 11.90 11.06 11.61 250747
2011-08-10 11.45 12.00 10.81 10.98 220345
2011-08-11 11.24 12.05 11.08 11.92 193707
2011-08-12 11.98 12.41 11.32 11.62 131879
2011-08-15 11.74 12.18 11.48 12.09 68166
2011-08-16 12.00 12.51 11.51 12.13 105672
2011-08-17 12.21 12.40 11.18 12.11 100222
2011-08-18 11.85 11.85 10.87 11.01 268504
2011-08-19 10.85 11.09 10.25 10.55 318356
2011-08-22 10.76 10.96 10.18 10.44 408533
2011-08-23 10.50 11.66 10.50 11.64 253056
2011-08-24 11.57 11.95 10.84 11.91 159916
2011-08-25 11.94 11.97 11.27 11.57 102510
2011-08-26 11.54 12.15 11.40 12.14 94895
2011-08-29 12.24 12.67 12.24 12.44 82986
2011-08-30 12.33 12.88 12.00 12.07 92261
2011-08-31 12.15 12.23 11.73 12.08 104907
2011-09-01 12.12 12.55 11.90 11.95 138396
2011-09-02 11.73 11.81 11.39 11.74 94523
2011-09-06 11.39 12.16 11.39 11.67 90053
2011-09-07 11.85 12.16 11.73 11.88 89037
2011-09-08 11.80 11.83 11.47 11.49 52527
2011-09-09 11.40 11.56 11.23 11.37 69453
2011-09-12 11.21 11.57 11.07 11.16 80107
2011-09-13 11.21 11.58 11.08 11.46 143366
2011-09-14 11.47 12.41 11.26 12.41 147671
2011-09-15 12.40 12.86 11.84 12.77 135405
2011-09-16 12.84 12.85 12.41 12.77 226268
2011-09-19 12.60 12.60 12.19 12.55 53080
2011-09-20 12.61 12.61 11.86 11.95 89676
2011-09-21 11.84 12.24 11.52 11.57 182474
2011-09-22 11.27 11.68 10.73 11.24 266970
2011-09-23 11.31 11.73 10.88 11.63 54027
2011-09-26 11.65 11.91 11.07 11.88 81391
2011-09-27 12.06 12.63 11.77 12.20 111174
2011-09-28 12.16 12.32 11.83 12.13 84193
2011-09-29 12.40 12.75 12.00 12.73 105479
2011-09-30 12.58 12.73 12.14 12.50 83506
2011-10-03 12.34 12.34 11.42 11.70 178083
2011-10-04 11.67 12.47 11.45 12.43 179955
2011-10-05 12.46 12.83 11.87 12.73 76279
2011-10-06 12.70 13.26 12.46 13.14 105221
2011-10-07 13.19 13.80 12.86 13.10 127641
2011-10-10 13.33 13.44 12.99 13.43 92285
2011-10-11 13.31 14.20 13.09 13.71 140115
2011-10-12 13.89 14.54 13.70 14.52 109867
2011-10-13 15.14 16.27 15.14 15.90 392420
2011-10-14 16.03 16.09 15.53 15.63 119922
2011-10-17 15.57 15.89 14.62 14.82 114603
2011-10-18 14.87 15.38 14.39 14.91 96206
2011-10-19 14.86 15.00 14.18 14.49 77992
2011-10-20 14.53 14.91 14.05 14.19 83684
2011-10-21 14.43 14.98 13.80 14.93 95449
2011-10-24 14.95 15.90 14.84 15.87 105182
2011-10-25 15.76 15.80 14.96 15.03 60458
2011-10-26 15.26 15.85 14.40 15.21 142744
2011-10-27 16.00 16.55 15.30 16.21 346546
2011-10-28 16.50 16.98 15.88 16.51 257229
2011-10-31 16.38 17.21 15.97 16.46 103596
2011-11-01 16.03 16.18 15.30 15.37 92976
2011-11-02 15.48 16.49 15.12 15.73 175859
2011-11-03 16.01 16.94 15.56 16.41 160698
2011-11-04 16.30 16.40 15.91 16.20 69796
2011-11-07 16.20 16.70 15.72 16.46 72304
2011-11-08 16.59 16.59 15.76 16.40 99014
2011-11-09 15.94 16.50 14.60 15.45 238791
2011-11-10 15.59 15.74 14.31 15.71 196457
2011-11-11 15.81 16.25 15.72 16.19 146219
2011-11-14 16.18 17.24 16.17 16.91 168475
2011-11-15 16.86 17.02 16.49 16.74 146063
2011-11-16 16.66 17.48 16.50 16.58 323131
2011-11-17 16.59 16.74 15.76 16.03 176343
2011-11-18 16.06 16.58 15.41 15.95 138643
2011-11-21 15.68 16.60 15.31 16.49 242969
2011-11-22 16.48 16.75 16.11 16.54 423068
2011-11-23 16.39 16.52 16.16 16.36 327260
2011-11-25 16.33 16.59 16.25 16.31 149783
2011-11-28 16.76 17.25 16.65 17.03 264535
2011-11-29 17.05 17.22 15.73 16.11 419119
2011-11-30 16.74 16.74 16.07 16.13 1214942
2011-12-01 15.79 16.26 15.33 16.03 283707
2011-12-02 16.29 16.63 16.00 16.20 204757
2011-12-05 16.49 16.99 16.01 16.18 255330
2011-12-06 15.90 15.90 14.67 15.37 535196
2011-12-07 15.31 16.15 15.27 16.00 331880
2011-12-08 15.56 15.90 15.35 15.66 217188
2011-12-09 15.73 15.97 15.37 15.81 110132
2011-12-12 15.47 15.88 15.47 15.79 105524
2011-12-13 15.73 15.78 15.16 15.24 127710
2011-12-14 15.13 15.47 14.99 15.45 167044
2011-12-15 15.59 15.80 15.44 15.57 285980
2011-12-16 15.60 15.60 15.08 15.33 284700
2011-12-19 15.40 15.49 15.10 15.25 166632
2011-12-20 15.45 15.66 15.32 15.44 111319
2011-12-21 15.42 15.64 15.20 15.52 149049
2011-12-22 15.64 16.00 15.64 15.78 283546
2011-12-23 15.86 15.86 15.61 15.69 128812
2011-12-27 15.59 15.78 15.32 15.69 112615
2011-12-28 15.63 15.63 15.23 15.28 47269
2011-12-29 15.33 15.50 15.25 15.38 44222
2011-12-30 15.35 15.67 15.02 15.60 107850
2012-01-03 15.70 15.70 14.90 15.07 201100
2012-01-04 14.95 15.12 14.44 14.62 175055
2012-01-05 14.48 14.61 14.15 14.46 144614
2012-01-06 14.41 14.58 14.34 14.50 43442
2012-01-09 14.65 15.06 14.56 14.93 148695
2012-01-10 15.11 15.23 14.81 14.99 327469
2012-01-11 15.01 15.60 15.01 15.49 163678
2012-01-12 15.57 15.57 15.05 15.16 107073
2012-01-13 15.05 15.31 14.90 15.02 89934
2012-01-17 14.20 14.59 14.05 14.19 475254
2012-01-18 14.21 14.50 13.90 14.48 483087
2012-01-19 14.36 14.72 14.00 14.67 830295
2012-01-20 15.19 15.60 15.06 15.54 6734040
2012-01-23 15.51 15.90 15.43 15.80 730008
2012-01-24 15.74 15.82 15.41 15.75 386643
2012-01-25 15.95 16.74 15.89 16.25 845655
2012-01-26 16.42 16.51 15.70 15.80 560142
2012-01-27 15.72 16.32 15.56 16.23 513355
2012-01-30 16.37 16.57 16.17 16.51 776016
2012-01-31 16.31 17.19 16.22 16.79 1201077
2012-02-01 16.81 17.25 16.68 17.19 957484
2012-02-02 17.30 18.12 17.26 18.08 1409098
2012-02-03 18.50 19.35 18.17 19.21 1706109
2012-02-06 19.40 19.49 18.62 18.99 660248
2012-02-07 18.99 18.99 18.56 18.63 304395
2012-02-08 18.72 18.74 18.02 18.42 368522
2012-02-09 18.42 18.44 17.75 18.24 524795
2012-02-10 18.12 18.36 17.90 18.30 601245
2012-02-13 18.82 19.95 18.71 19.73 1954357
2012-02-14 19.78 19.84 19.15 19.49 731832
2012-02-15 19.66 19.81 19.17 19.23 762459
2012-02-16 19.37 19.77 16.33 19.22 1606670
2012-02-17 19.44 19.96 19.00 19.82 857068
2012-02-21 19.96 19.96 18.33 19.11 1225098
2012-02-22 18.95 19.35 18.67 19.29 406027
2012-02-23 19.29 19.40 18.76 19.09 739533
2012-02-24 19.13 19.43 18.42 18.65 682107
2012-02-27 18.64 18.99 18.15 18.86 594306
2012-02-28 18.88 19.28 18.73 19.22 371933
2012-02-29 19.25 19.90 19.18 19.53 515401
2012-03-01 19.57 19.80 19.09 19.25 351685
2012-03-02 19.10 19.47 18.45 18.49 278203
2012-03-05 18.49 19.34 18.45 19.16 713818
2012-03-06 19.05 19.24 18.57 18.92 417230
2012-03-07 18.93 19.11 18.50 18.94 347715
2012-03-08 19.02 19.24 18.72 19.11 312137
2012-03-09 19.05 19.68 18.76 19.35 295356
2012-03-12 19.55 19.76 19.29 19.42 209142
[ reached getOption("max.print") -- omitted 1236 rows ]
Plot times series using ggplot2
Plot stock price by year (time series)
Show the structure of this xtx time series object from FRED for acquiring general financial data
[1] "CPIAUCNS"
[1] "CPIAUCNS"
An ‘xts’ object on 1913-01-01/2016-12-01 containing:
Data: num [1:1248, 1] 9.8 9.8 9.8 9.8 9.7 9.8 9.9 9.9 10 10 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr "CPIAUCNS"
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
$ src : chr "FRED"
$ updated: POSIXct[1:1], format: "2017-02-09 03:19:02"
NULL
Plot time series for CPIAUCNS
Get Real Gross National Product in 2005 dollars
An ‘xts’ object on 1947-01-01/2016-07-01 containing:
Data: num [1:279, 1] 1947 1945 1943 1974 2004 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr "GNPC96"
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
$ src : chr "FRED"
$ updated: POSIXct[1:1], format: "2017-02-09 03:20:02"
NULL
Plot the series
Get National Civilian Unemployment Rate
[1] "UNRATENSA"
[1] "UNRATENSA"
An ‘xts’ object on 1948-01-01/2017-01-01 containing:
Data: num [1:829, 1] 4 4.7 4.5 4 3.4 3.9 3.9 3.6 3.4 2.9 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr "UNRATENSA"
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
$ src : chr "FRED"
$ updated: POSIXct[1:1], format: "2017-02-09 03:20:35"
NULL
Plot the series
Get University of Michigan: Consumer Sentiment:
[1] "UMCSENT"
[1] "UMCSENT"
An ‘xts’ object on 1978-01-01/2016-12-01 containing:
Data: num [1:468, 1] 83.7 84.3 78.8 81.6 82.9 80 82.4 78.4 80.4 79.3 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr "UMCSENT"
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
$ src : chr "FRED"
$ updated: POSIXct[1:1], format: "2017-02-09 03:21:06"
NULL
Plot time series for UMCSENT
Get HSN1FNSA
[1] "HSN1FNSA"
[1] "HSN1FNSA"
An ‘xts’ object on 1963-01-01/2016-12-01 containing:
Data: int [1:648, 1] 42 35 44 52 58 48 62 56 49 44 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr "HSN1FNSA"
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
$ src : chr "FRED"
$ updated: POSIXct[1:1], format: "2017-02-09 03:21:42"
NULL
Plot HSN1FNSA time series
Multiple time series plot - putting consumer sentiment and new home sales on the same plot
[1] "UMCSENT"
get HSN1FNSA and plot time series on New Homes Sold in the US, not seasonally adjusted (monthly, millions)
[1] "HSN1FNSA"
Examine the structure of the multiple time series object
Time-Series [1:468, 1:2] from 1978 to 2017: 83.7 84.3 78.8 81.6 82.9 80 82.4 78.4 80.4 79.3 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:2] "ICS" "NHS"
- attr(*, "na.action")=Class 'omit' int [1:180] 1 2 3 4 5 6 7 8 9 10 ...
NULL
Examine data frame structure and notice an intentional shift to underline in the data frame name.
'data.frame': 468 obs. of 3 variables:
$ ICS : num 83.7 84.3 78.8 81.6 82.9 80 82.4 78.4 80.4 79.3 ...
$ NHS : num 57 63 75 85 80 77 68 72 68 70 ...
$ Year: num 1978 1978 1978 1978 1978 ...
NULL
Print first six rows of observations.
Using ggplot2 time series plotting of economic data
Plot Time Series Decomposition for Spirit Airlines Stock Price (NASDAQ stock symbol: SAVE) using Quandl