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
You could use
dplyr::filter()
and negate agrepl()
match:Or with
dplyr::filter()
and negating astringr::str_detect()
match:This should do the trick:
Or a safer version would be:
Actually I would use:
This will avoid deleting all of the records if the desired search word is not contained in any of the rows.
You can use stri_detect_fixed function from
stringi
package