Example data frame:
> df <- data.frame(A = c('a', 'b', 'c'), B = c('c','d','e'))
> df
A B
1 a c
2 b d
3 c e
The following returns all rows in which any value is "c"
> df %>% filter_all(any_vars(. == "c"))
A B
1 a c
2 c e
How do I return the inverse of this, all rows in which no value is ever "c"? In this example, that would be row 2 only. Tidyverse solutions preferred, thanks.
EDIT: To be clear, I am asking about exact matching, I don’t care if a value contains a "c", just if the value is exactly "c".
>Solution :
dplyr
FYI, filter_all has been superseded by the use of if_any or if_all.
df %>%
filter(if_all(everything(), ~ . != "c"))
# A B
# 1 b d