0
假設數據按年份然後按月排序(數據總是有3個觀測值)。
Year Month Index
2014 11 1.1
2014 12 1.5
2015 1 1.2
我需要上個月的Index
複製到新的觀察
Year Month Index
2014 11 1.1
2014 12 1.5
2015 1 1.2
2015 2 1.2
案例2
Year
從數據中刪除。所以我們只有Month
和Index
。
Month Index
1 1.2
11 1.1
12 1.5
數據總是從連續3個月收集。所以1
是最後一個月。
不過,理想的輸出爲
Month Index
1 1.2
2 1.2
11 1.1
12 1.5
我解決它通過創建另一數據集僅包含Month
(1,2 ... 12)。然後右鍵兩次加入原始數據集。但我認爲有更優雅的方式來處理這個問題。