Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make ITime accept NA #1410

Closed
httassadar opened this issue Oct 28, 2015 · 1 comment
Closed

make ITime accept NA #1410

httassadar opened this issue Oct 28, 2015 · 1 comment
Assignees
Milestone

Comments

@httassadar
Copy link

packageVersion("data.table")
[1] ‘1.9.6’

as.ITime(NA)
Error in if (any(neg)) res[neg] = paste("-", res[neg], sep = "") :
missing value where TRUE/FALSE needed
as.IDate(NA)
[1] NA

This causes trouble at key lookup and joining.

DT = data.table(timestamp = "2010-01-01 00:00:00")
DT
timestamp
1: 2010-01-01 00:00:00
DT[, c("date", "time") := IDateTime(as.POSIXct(timestamp))]
DT
timestamp date time
1: 2010-01-01 00:00:00 2010-01-01 00:00:00
setkey(DT, date)
DT[.(as.IDate("2010-01-01"))]
timestamp date time
1: 2010-01-01 00:00:00 2010-01-01 00:00:00
DT[.(as.IDate("2010-01-02"))]
Error in if (any(neg)) res[neg] = paste("-", res[neg], sep = "") :
missing value where TRUE/FALSE needed

@arunsrinivasan
Copy link
Member

Fixed in devel v1.9.7. From README:

as.ITime(NA) works as intended, #1354. Thanks @geneorama.

Please check on devel versions before posting.

Also it'd really help if you'd take the time to read about formatting posts on github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants