In a dataframe like this:
df <- data.frame(id = c(1,2,3), text = c("hi my name is E","hi what's your name","name here"))
I would like to keep row which contain both hi and name words in a row. Example of expended output:
df <- data.frame(id = c(1,2,3), text = c("hi my name is E","hi what's your name"))
I try this but it doesn't work properly:
library(tidyverse)
df %>%
filter(str_detect(text, 'name&hi'))