-2

I want to delete rows in the column "Keyword" which contains words including "advertising", "advertise", and "advertisement".

The data frame looks like this:

Jaap
  • 81,064
  • 34
  • 182
  • 193
Ryan Tao
  • 33
  • 1
  • 6
  • `dplyr::filter(df, !grepl("advertis", Keyword))` – Nate Jan 11 '17 at 15:49
  • Do not post your data as an image, please learn how to give a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610) – Jaap Jan 11 '17 at 16:45

1 Answers1

1

We can use grep

df2 <- df1[grep("\\badvert.*", df1$Keyword, invert=TRUE),]

If the three words are specific, as @Frank suggested, the pattern can be replaced by "\\badvertis(ement|ing|e)\\b"

akrun
  • 874,273
  • 37
  • 540
  • 662