purrr
purrr copied to clipboard
every() depends on vector order when NA is present
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
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 :/
While this will change behaviour, I wouldn't characterise it as a breaking change; more that it's fixing a bug.