Skip to content

Fail to preserve Date object #13

@renkun-ken

Description

@renkun-ken

If a column of a data frame is Date or POSIXct or POSIXlt-class vector, they will be printed as integers in the column.

library(DT)
datatable(data.frame(date = seq(as.Date("2015-01-01"), by = "day", length.out = 5), x = 1:5))

will produce a DataTable like

date    x
16436   1
16437   2
16438   3
16439   4
16440   5

The same thing does not happen with knitr::kable:

> knitr::kable(data.frame(date = seq(as.Date("2015-01-01"), by = "day", length.out = 5), x = 1:5))


|date       |  x|
|:----------|--:|
|2015-01-01 |  1|
|2015-01-02 |  2|
|2015-01-03 |  3|
|2015-01-04 |  4|
|2015-01-05 |  5|

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions