如果我的一个表有多个时间戳值,而另一个只有一个,我可以在多个值中重复单个项目的值吗?
例如:
XTS_A:
2011/01/01 10:00:00,Bar
2011/01/01 10:00:01,Baz
XTS_B:
2011/01/01 10:00:00,A
2011/01/01 10:00:00,B
2011/01/01 10:00:00,C
2011/01/01 10:00:01,B
合并结果:
2011/01/01 10:00:00,A,Bar
2011/01/01 10:00:00,B,Bar
2011/01/01 10:00:00,C,Bar
2011/01/01 10:00:01,B,Baz
可重现的例子:
library(zoo)
library(xts)
XTS_A <- structure(c("Bar", "Baz"), .Dim = c(2L, 1L), index = structure(c(1293894000, 1293894001), tzone = "", tclass = c("POSIXt", "POSIXct")), class = c("xts", "zoo"), .indexCLASS = c("POSIXt", "POSIXct"), .indexTZ = "")
XTS_B <- structure(c("A", "B", "C", "B"), .Dim = c(4L, 1L), index = structure(c(1293894000, 1293894000, 1293894000, 1293894001), tzone = "", tclass = c("POSIXt", "POSIXct")), class = c("xts", "zoo"), .indexCLASS = c("POSIXt", "POSIXct"), .indexTZ = "")