You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The if_any() function returns TRUE if we pass an empty vector of columns. I think this behavior is unexpected and may introduce subtle bugs if your tidyselect function does not match any columns. I think it should possibly return an error.
iris %>%
mutate(z= if_any(c(), ~.>4000)) # returns all TRUEiris %>%
mutate(z= if_any(starts_with("XYZ"), ~.>4000)) # returns all TRUE
The text was updated successfully, but these errors were encountered:
The correct behavior is actually to return all FALSE here, consistent with the base function any() when no inputs are provided. I don't think we want to error, we just want consistent and explainable behavior
@DavisVaughan Thanks for explaining. But, I don't think this behavior is fixed. I updated to the latest version and using if_any in mutate with zero cols incorrectly returns all TRUE, although I think it works correctly inside filter. You can try the examples I posted above.
The
if_any()
function returns TRUE if we pass an empty vector of columns. I think this behavior is unexpected and may introduce subtle bugs if your tidyselect function does not match any columns. I think it should possibly return an error.The text was updated successfully, but these errors were encountered: