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

Feature Request: When all values are NA, don't warn that parse_date_time didn't parse #530

Closed
billdenney opened this issue Mar 28, 2017 · 1 comment

Comments

@billdenney
Copy link
Contributor

@billdenney billdenney commented Mar 28, 2017

The reporting of formats failing to parse is a bit inconsistent. When all values passed to parse_date_time are NA, the warning of "all formats failed to parse" is given. When some (but not all) are NA, no warning is given for the NA values even though technically it's the same type of issue.

Feature request: If all values are NA, do not warn that all formats failed to parse. (I know I could use the quiet argument to silence the warning, but I want the warning in the case of actual parsing errors.)

> parse_date_time(NA,
+                 orders=c("%Y-%m-%d %H:%M", "%d%b%Y:%H:%M:%S", "%d%b%y:%H:%M"))
Warning: All formats failed to parse. No formats found.
[1] NA
> parse_date_time(c(NA, "2017-01-01 01:01"),
+                 orders=c("%Y-%m-%d %H:%M", "%d%b%Y:%H:%M:%S", "%d%b%y:%H:%M"))
[1] NA                        "2017-01-01 01:01:00 UTC"
> parse_date_time(c("foo", NA, "2017-01-01 01:01"),
+                 orders=c("%Y-%m-%d %H:%M", "%d%b%Y:%H:%M:%S", "%d%b%y:%H:%M"))
Warning:  1 failed to parse.
[1] NA                        NA                        "2017-01-01 01:01:00 UTC"
@vspinu
Copy link
Member

@vspinu vspinu commented Mar 28, 2017

Good point. It's an inconsistency indeed.

vspinu added a commit that referenced this issue May 6, 2017
@vspinu vspinu closed this in 78fbe12 May 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.