【问题标题】:milli/micro second resolution for ITimeITime 的毫秒/微秒分辨率
【发布时间】:2012-11-12 04:29:25
【问题描述】:

我正在尝试更广泛地使用 data.tableITime 是 UDT 复制 POSIXlt "DateTime" 类型。

> strptime("01-04-2012 09:23:45.987364", format="%d-%m-%Y %H:%M:%OS")
[1] "2012-04-01 09:23:45.987364"
> time = strptime("01-04-2012 09:23:45.987364", format="%d-%m-%Y %H:%M:%OS")
> class(time)
[1] "POSIXlt" "POSIXt" 

但我无法使用 ITime 获得 ms 或 micro

> time = as.ITime("09:23:45.987364", format="%H:%M:%OS")
> time
[1] "09:23:45"

如何使用 ITime 处理分数? 干杯

【问题讨论】:

    标签: r time-series data.table


    【解决方案1】:

    似乎不可能。

    IDateTime {data.table}  R Documentation
    Integer based date class
    
    
    Details
    
    ITime is a time-of-day class stored as the integer number of seconds in the day. as.ITime does not allow days longer than 24 hours. Because ITime is stored in seconds, you can add it to a POSIXct object, but you should not add it to a Date object.
    

    【讨论】:

    • 正确。 ITime 不可能。使用 POSIXct 表示 ms 或 micro。并避免像瘟疫一样避免POSIXlt
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-12
    • 2018-06-01
    • 2011-01-25
    • 2018-10-29
    • 2014-09-08
    相关资源
    最近更新 更多