Dataframe to xts conversion fails on update from xts 0.9.7 to 0.10.0.
#THIS WORKS (uses xts 0.9.7):
library(xts)
DFX <- structure(list(DateTime = structure(list(sec = c(0, 0, 0), min = c(10L, 0L, 5L), hour = c(17L, 18L, 18L), mday = c(24L, 24L, 24L), mon = c(5L, 5L, 5L), year = c(114L, 114L, 114L), wday = c(2L, 2L, 2L), yday = c(174L, 174L, 174L), isdst = c(1L, 1L, 1L), zone = c("EDT", "EDT", "EDT"), gmtoff = c(NA_integer_, NA_integer_, NA_integer_)), .Names = c("sec", "min", "hour", "mday", "mon", "year", "wday", "yday", "isdst", "zone", "gmtoff"), class = c("POSIXlt", "POSIXt")), Open = c(125.03, 125.34, 125.85)), .Names = c("DateTime", "Open"), class = "data.frame", row.names = 558:560)
DFX <- as.xts(DFX[, -1], order.by = DFX$DateTime)
#THIS DOESN'T WORK (uses xts 0.10.1):
install.packages("devtools")
require(devtools)
install_github("joshuaulrich/xts")
library(xts)
DFX <- structure(list(DateTime = structure(list(sec = c(0, 0, 0), min = c(10L, 0L, 5L), hour = c(17L, 18L, 18L), mday = c(24L, 24L, 24L), mon = c(5L, 5L, 5L), year = c(114L, 114L, 114L), wday = c(2L, 2L, 2L), yday = c(174L, 174L, 174L), isdst = c(1L, 1L, 1L), zone = c("EDT", "EDT", "EDT"), gmtoff = c(NA_integer_, NA_integer_, NA_integer_)), .Names = c("sec", "min", "hour", "mday", "mon", "year", "wday", "yday", "isdst", "zone", "gmtoff"), class = c("POSIXlt", "POSIXt")), Open = c(125.03, 125.34, 125.85)), .Names = c("DateTime", "Open"), class = "data.frame", row.names = 558:560)
DFX <- as.xts(DFX[, -1], order.by = DFX$DateTime)
#Error message:
#Error in .Call("do_is_ordered", x = x, increasing = as.logical(increasing), :
# "do_is_ordered" not available for .Call() for package "xts"
Guess xts 0.10.0 is not a finished build. Yet I updated to 0.10.0 as quantstrat package requires blotter package, which requires xts 0.10.0. I needed this to turn a tick data dataframe into an xts object, to run a quantstrat strategy on it (requires xts objects).