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() depends on vector order when NA is present #751

Closed
alberto-dellera opened this issue Mar 6, 2020 · 2 comments · Fixed by #784
Closed

every() depends on vector order when NA is present #751

alberto-dellera opened this issue Mar 6, 2020 · 2 comments · Fixed by #784
Labels
bug an unexpected problem or unintended behavior map 🗺️

Comments

@alberto-dellera
Copy link

library(purrr)

every( c(FALSE, NA), identity )
#> [1] FALSE
every( c(NA, FALSE), identity )
#> [1] NA

IMHO it should return the same and be consistent with &&:

FALSE && NA
#> [1] FALSE
NA && FALSE
#> [1] FALSE
@lionel- lionel- added breaking change ☠️ API change likely to affect existing code bug an unexpected problem or unintended behavior labels Jun 5, 2020
@lionel-
Copy link
Member

lionel- commented Aug 5, 2020

I think your analysis is correct. Especially since some() is implemented using || so it has the same behaviour as that operator. It would make a lot of sense for every() to behave like &&. This would be a behaviour change though :/

@hadley
Copy link
Member

hadley commented Aug 24, 2022

While this will change behaviour, I wouldn't characterise it as a breaking change; more that it's fixing a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior map 🗺️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants