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

Condition handling for NA values #16

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

Condition handling for NA values #16

mcjudd opened this issue Oct 18, 2016 · 3 comments

Comments

@mcjudd
Copy link

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
Copy link
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
Copy link
Owner

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

@eddelbuettel
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants