2012-11-23 40 views
1

我想更廣泛地使用data.tableITime是UDT複製POSIXlt「DateTime」類型。milli/micro秒分辨率

> 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" 

但我不能讓MS或微有ITIME

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

我如何處理與ITIME分數? 乾杯

回答

4

似乎不可能。

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. 
+3

正確。不可能與ITime。對於ms或micro使用'POSIXct'。避免像鼠疫這樣的「POSIXlt」。 –