How to remove rows from data frame who's row name contains a specific string

Do you mean something like this?

library(tidyverse)

# original
df <- tibble(x = c("aaa", "aab", "aac"),
       y = c("aa.1", "bb.1", "ccc"))

> df
# A tibble: 3 × 2
  x     y    
  <chr> <chr>
1 aaa   aa.1 
2 aab   bb.1 
3 aac   ccc  

# filtered
df %>% 
  filter(!str_detect(y, ".1"))

# A tibble: 1 × 2
  x     y    
  <chr> <chr>
1 aac   ccc  

Next time, please provide a reproducible example.

1 Like