I would like to subset columns (using a dplyr friendly method if possible) based on values in the rows.
The data frame looks like this but with more columns:
df <-
data.frame(a = c("a","b","c","bingo"),
b = c("d","e","a","b"),
c = c("bingo","bingo","a","e"))
I want to select only columns that contains the value "bingo" something like
df %>% select(columns_that_contain("bingo"))
The expected output:
a c
1 a bingo
2 b bingo
3 c a
4 bingo e
Any help will be appreciated!