I would expect cbind.xts
and do.call(cbind.xts)
to perform with similar elapsed time.
That was true for R2.11, R2.14.
For R2.15.2 and xts 0.8-8, the do.call(cbind.xts,...)
variant performs drastically slower, which effectively breaks my previous codes.
As Josh Ulrich notes in a comment below, the xts package maintainers are aware of this problem. In the meantime, is there a convenient work around?
Reproducible example:
library(xts)
secs <- function (rows, from = as.character(Sys.time()), cols = 1, by = 1)
{
deltas <- seq(from = 0, by = by, length.out = rows)
nacol <- matrix(data = NA, ncol = cols, nrow = rows)
xts(x = nacol, order.by = strptime(from, format = "%Y-%m-%d %X") +
deltas)
}
n <- 20
d1 <- secs(rows=n*100,cols=n)
d2 <- secs(rows=n*100,cols=n)
system.time(cbind.xts(d1,d2))
versus
system.time(do.call(cbind.xts, list(d1,d2)))