I'm analysing reddit threads for an assignment and I only want to include threads that contain certain keywords.
I have a list of keywords: keywords <- c(addict', 'addicted', 'addiction','addictive', 'afraid' ,'anxiety','anxious','cry','crying','delusion','delusional')
The dataframe has 3 columns. I want to only include rows that contain one of the keywords in the column called title.
e.g.
| title | created_utc | |
|---|---|---|
| 1 | Anyone have a RH wallet yet? Asking for a friend | 164128421 |
| 2 | Ravi Menon, managing director of the Monetary Auth... | 164131283 |
| 3 | Different Augmented Reality(AR) NFT apps and marke... | 164134123 |
keywordstest2<-paste0(keywords, collapse = "|")
dfsub%>% filter(grepl(keywordstest2,title))
Tried this, obvs didn't work.
Does anyone know how to do this. Thanks :D