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

every() and NAs #174

Closed
kablag opened this issue Feb 4, 2016 · 2 comments
Closed

every() and NAs #174

kablag opened this issue Feb 4, 2016 · 2 comments
Labels
bug

Comments

@kablag
Copy link

@kablag kablag commented Feb 4, 2016

I'm very impressed by purrr but from my point of view it's strange result:
every(NA, function(x) x > 0)
[1] FALSE
Doesn't it break R rules about NA?
Maybe it's better to return NA like all()?
all(c(NA) > 0)
[1] NA

@lionel-
Copy link
Member

@lionel- lionel- commented Feb 7, 2016

hmm yes, we should probably return NA if one element of .x is NA. And with some(), we should do the same except if one element is TRUE.

@hadley hadley added the bug label Mar 3, 2017
@hadley
Copy link
Member

@hadley hadley commented Mar 3, 2017

library(purrr)
every(NA, ~ .x > 0)
#> [1] FALSE
@hadley hadley closed this in b26029d Mar 4, 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
3 participants