dplyr filter regex grepl case code example
Example 1: filter grepl r
df1 %>% filter(!grepl("^x|xx$", fruit))
###
fruit group
1 apple A
2 orange B
3 banxana A
4 appxxle B
Example 2: grepl filter r
df1 %>% filter(!grepl("^x|xx$", fruit))