Condition handling for NA values #16

Closed
mcjudd opened this Issue Oct 18, 2016 · 3 comments

Projects

None yet

2 participants

@mcjudd
mcjudd commented Oct 18, 2016

Hello,

Are there any plans to change condition handling for NA values so that their presence in a vector simply throws a warning versus an error? For instance...

anydate(c("20010101", "02/02/1902", NA))

... gives me the error:

Error in eval(substitute(expr), envir, enclos) : Inadmissable input: NA

I have gotten around this issue of parsing date formats while accounting for the presence of NA values by using lubridate::parse_date_time(), but think that adding such functionality to your package, combined with its parsing flexibility (and the keystrokes saved by not having to specify the orders parameter in parse_date_time()) would make it an extremely attractive option for daily use.

Thank you,
Mike

@eddelbuettel
Owner

Yes, try the GH master branch which already does this:

R> library(anytime)
R> anydate(c("20010101", "02/02/1902", NA, 20010203))
[1] "2001-01-01" "1902-02-02" NA           "2001-02-03"
R> 

Should be on CRAN within days.

@eddelbuettel
Owner

But even with the existing version you can get by with pre-indexing. No need for lubdridate.

@eddelbuettel
Owner

I spoke too soon in regards to the master branch. That was still uncommitted on my box. It should still hit CRAN within days, I hope.

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