I would like to exclude lines containing a string "REVERSE", but my lines do not match exactly with the word, just contain it.
My input data frame:
Value Name 55 REVERSE223 22 GENJJS 33 REVERSE456 44 GENJKI
My expected output:
Value Name 22 GENJJS 44 GENJKI
This should do the trick:
df[- grep("REVERSE", df$Name),]
Or a safer version would be:
df[!grepl("REVERSE", df$Name),]
2.1m questions
2.1m answers
60 comments
56.9k users