6

尝试对象时merge, argxts似乎无法suffixes正常工作:

require(xts)
x <- xts(1:10, seq.Date(from=as.Date("2012-01-01"), len=10, by=1))
y <- xts(11:20, seq.Date(from=as.Date("2012-01-01"), len=10, by=1))

names(x) <- "x"
names(y) <- "x"

merge(x,y,suffixes=c("truex", "truey"))

            x x.1
2012-01-01  1  11
2012-01-02  2  12
2012-01-03  3  13
2012-01-04  4  14
2012-01-05  5  15
2012-01-06  6  16
2012-01-07  7  17
2012-01-08  8  18
2012-01-09  9  19
2012-01-10 10  20

我在滥用吗?

4

1 回答 1

8

虽然merge.xts似乎坏了,merge.zoo但确实有效:

> merge.zoo(x,y,suffixes=c("truex", "truey"))
           x.truex x.truey
2012-01-01       1      11
2012-01-02       2      12
2012-01-03       3      13
2012-01-04       4      14
2012-01-05       5      15
2012-01-06       6      16
2012-01-07       7      17
2012-01-08       8      18
2012-01-09       9      19
2012-01-10      10      20
于 2012-12-01T01:47:17.563 回答