Skip to content

as.dt.xts error on single row  #1484

@jangorecki

Description

@jangorecki

From mailing list email:

Michael Smith | 3 Jan 06:33 2016
Picon
Bug in as.data.table.xts?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions