5

我很惊讶这样做,使用data.table包:

a = as.ITime('12:01:00')
str(a)
Class 'ITime'  int 4326
a = as.ITime(c('12:01:00','12:00:02'))
Message d'avis :
In if (!is.na(y)) return(as.ITime(y)) :
  la condition a une longueur > 1 et seul le premier élément est utilisé
str(a)
Class 'ITime'  int [1:2] 43260 43202

为什么这条线会抛出 WARNING ?

4

1 回答 1

2

This has been fixed in data.table 1.9.2. From NEWS:

o as.ITime.character no longer complains when given vector input, and will accept mixed format time entries; e.g., c("12:00", "13:12:25")

Here's an example:

as.ITime(c('12:01:00','12:00:02'))
[1] "12:01:00" "12:00:02"
于 2014-04-21T19:53:59.740 回答