I have a data-frame with a column consisting of comma separated words. I want to filter rows with exact combination of words
text
a,boy,and,a,girl
mummy, and, papa
teach, learn
teach, learn
teach
for eg: I want rows with teach,learn only
Try this
df <- data.frame(column_name = c("text", "a,boy,and,a,girl", "teach", "teach, learn"))
This gives is how the data frame would look like. Then you can do the following filter using dplyr package:
test <- df %>% filter(grepl("teach|text", column_name))