I am trying to find rows via if_any and have run into a very strange behavior. Is this a bug?
my_DF <- data.frame( a = c(1, 1, NA, 1),
b = c(1, NA, 1, 12))
my_DF
my_DF %>%
filter( if_any(everything(), ~ .x == 12 && .y==1))
my_DF %>%
filter( if_any(everything(), ~ .x == 1 && .y==12))
the first filter returns an empty dataframe, which is correct. The second filter causes an error that I can't understand.
Simplifying the code:
my_DF <- data.frame( a = c(1, 1, NA, 1),
b = c(1, NA, 1, 12))
my_DF
my_DF %>%
filter( if_any(everything(), ~ .x == 1 && .y==12))
Still produces the error.
I am new to the syntax involving if_any so maybe I am making some sort of beginners error?
Any help appreciated!
Carl