Delete rows containing specific strings in R
This should do the trick:
df[- grep("REVERSE", df$Name),]
Or a safer version would be:
df[!grepl("REVERSE", df$Name),]
You could use dplyr::filter()
and negate a grepl()
match:
library(dplyr)
df %>%
filter(!grepl('REVERSE', Name))
Or with dplyr::filter()
and negating a stringr::str_detect()
match:
library(stringr)
df %>%
filter(!str_detect(Name, 'REVERSE'))