Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

creating data.table::ITime vector

Tags:

r

data.table

I was surprised doing this, using the data.table package:

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

Why is this line throwing a WARNING ?

like image 959
statquant Avatar asked Nov 02 '22 21:11

statquant


1 Answers

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"
like image 112
Juancentro Avatar answered Nov 09 '22 07:11

Juancentro