[datatable-help] Bug in as.data.table.xts?

Michael Smith my.r.help at gmail.com
Sun Jan 3 06:33:52 CET 2016


Potential bug in as.data.table.xts when converting a single-row xts 
object. Using the dev version from GitHub.

library(xts)
library(data.table)
x <- as.xts(8, order.by = Sys.Date())

## Single-row conversion doesn't work.
as.data.table(x)

Error in as.data.frame.matrix(coredata(x), row.names, optional, ...) :
   row names must be 'character' or 'integer', not 'logical'


## Two rows work fine.
as.data.table(rbind(x, x))

         index V1
1: 2016-01-03  8
2: 2016-01-03  8


More information about the datatable-help mailing list