xts と plot() の復習

Rで学ぶ時系列データの可視化

Arnaud Amsellem

Quantitative Trader and creator of the R Trader blog

xts の復習

  • 時系列を扱う特別なクラス
  • eXtensible Time Series
  • xts = 時間インデックス + 行列
  • インデックスは時間オブジェクト: Date, POSIX Time, timeDate, chron

ch1_vid1_slides.003.png

Rで学ぶ時系列データの可視化

plot() と plot.xts()

  • plot()
  • plot.xts()
  • 描画対象が xts のときは plot()plot.xts() の代わりに使えます
Rで学ぶ時系列データの可視化

plot() の使用

ch1_vid1_slides.010.png

plot(my_ts)
Rで学ぶ時系列データの可視化

plot() の使用

ch1_vid1_slides.013.png

plot(my_ts, main = "my first time series")
lines(my_ts, col = "red", lwd = 2)
Rで学ぶ時系列データの可視化

plot() の使用

ch1_vid1_slides.022.png

plot(my_ts, main = "my first time series", 
            sub = "from Sep. 2008 to Dec. 2016")
lines(my_ts, col = "red", lwd = 2)
Rで学ぶ時系列データの可視化

練習しましょう!

Rで学ぶ時系列データの可視化

Preparing Video For Download...