我有兩個data.frames,我想追加在一起。一個data.frame保存過去的數據,另一個data.frame保存未來的預測數據。例如:rbind函數改變我的條目
past <- structure(list(Period = c("2010-01-01", "2010-02-01", "2010-03-01",
"2010-04-01", "2010-05-01", "2010-06-01"), Count = c(3379221317,
3379221317, 3791458246, 4182424930, 4891432401, 5116360744)),
.Names = c("Period", "Count"), row.names = c(NA, 6L), class = "data.frame")
future <- structure(list(Period = structure(c(15522, 15553, 15584, 15614,
15645, 15675), class = "Date"), Count = c(11051746713.9419, 11385578654.4160,
10864084232.2216, 11336164255.3271, 11121729107.9691, 12321341701.3780)),
.Names = c("Period", "Count"), row.names = c(NA, 6L), class = "data.frame")
我用rbind(past,future)
,由於某種原因從future
data.frame的Period
條目都改名。它看起來像:
> rbind(past,future)
Period Count
1 2010-01-01 3379221317
2 2010-02-01 3379221317
3 2010-03-01 3791458246
4 2010-04-01 4182424930
5 2010-05-01 4891432401
6 2010-06-01 5116360744
7 15522 11051746714
8 15553 11385578654
9 15584 10864084232
10 15614 11336164255
11 15645 11121729108
12 15675 12321341701
爲什麼我的日期重命名爲隨機數?
您的數據打印方式與存儲方式不同。請提供運行'dput(head(past))','dput(head(future))'和'dput(head(rbind(past,future)))'的結果。 – 2012-08-02 21:05:31