比較時間屬性
時間序列的起點與終點在 R 中與其他日期或時間物件的儲存方式相同,因此你可以對它們做比較測試,也可以進行運算來求出它們之間的時間間隔。
運用你的 R 技巧來操作 card_prices 的時間屬性——這是一個來自熱門交換卡牌遊戲的單張卡片每日價格時間序列。
你已可使用 card_prices 時間序列,以及 zoo 與 lubridate 套件。
本練習屬於課程
在 R 中操作時間序列資料
練習說明
將
card_prices的起點指定給變數card_start。將
card_prices的終點指定給變數card_end。以
card_end減去card_start,並檢視結果。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Assign the start point to card_start
___
# Assign the end point to card_end
___
# Subtract the start point from the end point
___