如何在DT表中显示小数秒

时间:2017-02-07 20:28:59

标签: r shiny dt

我想在DT数据表中看到毫秒:

options(digits.secs=6)
library(data.table)
d = data.table(x = 1:10,time = as.POSIXct('2015-03-23 12:00:00.123'))
library(DT)
datatable(d)

enter image description here

1 个答案:

答案 0 :(得分:1)

options(digits.secs=6)
library(data.table)
d = data.table(x = 1:10,time = as.POSIXct('2015-03-23 12:00:00.123'))
d$time = strftime(d$time,'%Y-%m-%d %H:%M:%OS3')

View(d)
library(DT)
datatable(d)

给出:

Show  entries
Search:
x   time
1   1   2015-03-23 12:00:00.122
2   2   2015-03-23 12:00:00.122
3   3   2015-03-23 12:00:00.122
4   4   2015-03-23 12:00:00.122