Skip to content

as.xts.data.table does not properly support all date based classes for index #2408

@ethanbsmith

Description

@ethanbsmith

xts objects support many date classes for the index, but the as.xts function only explicitly checks for small subset of classes.

fortunately, the xts::timeBased function will perform this check properly

i.e. replace
if (!any((index_class <- class(x[[1L]])) %in% c("POSIXct", "Date")))
with:
if(!xts::timeBased(x[[1L]]))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions