Search code examples
rdelete-row

Delete rows using conditional


I have a data.frame like this:

Client Product   
1      VV_Brazil_Jul
2      VV_Brazil_Mar
5      VV_US_Jul
1      VV_JP_Apr
3      VV_CH_May
6      VV_Brazil_Aug

I would like to delete all rows with "Brazil".


Solution

  • You can do the same thing with the tidyverse collection

    dplyr::slice(df, -stringr::str_which(df$Product, "Brazil"))