0
這是數據框。如何將10年間隔的趨勢數據讀入時間序列?
Year <- c(1901, 1911, 1921, 1931, 1941, 1951)
Population <- c(28445, 346222, 381046, 445606, 512069, 577635)
census <- cbind(Year, Population)
census <- as.data.frame(census)
census
Year Population
1 1901 28445
2 1911 346222
3 1921 381046
4 1931 445606
5 1941 512069
6 1951 577635
我希望它改變爲時間序列數據。
census.ts <- ts(census)
census.ts
Time Series:
Start = 1
End = 6
Frequency = 1
Year Population
1 1901 28445
2 1911 346222
3 1921 381046
4 1931 445606
5 1941 512069
6 1951 577635
時間間隔爲10年,似乎上面的代碼沒有準確讀取時間序列數據。我該如何解決這個問題?提前致謝!
這工作。欣賞它! – Loy 2015-01-28 05:29:06