Converting a data frame to xts

This is clearly documented — xts and zoo objects are formed by supplying two arguments, a vector or matrix carrying data and Date, POSIXct, chron, … type supplying the time information (or in the case of zoo the ordering).

So do something like

 qxts <- xts(q[,-1], order.by=q[,1])

and you should be set.

Leave a Comment