-1

I'm new in R and i was trying to filter data from my table using a specific keyword. For example, I have a column "messages" and I want to get all data CONTAINING the word "apple" not only data exactly equal to "apple" and save it to a separate table. So I was wandering if there is a way for me to do this?

Jaap
  • 81,064
  • 34
  • 182
  • 193
Jorge
  • 27
  • 1
  • 4

1 Answers1

0

We can use grep

df2 <- df1[grep("\\bapple\\b", df1$messages),]
akrun
  • 874,273
  • 37
  • 540
  • 662