Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

removing rows with specific values

I would like to remove rows that have specific values in a given column

id     x_col
1       c4_2342
1       c4_2122 
2       c3_1212
2       c39990

I want to remove everything that has "c4"

id     x_col
2       c3_1212
2       c39990

Can someone please help?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Variation on @akrun:

library(dplyr)
library(stringr)

df1 %>%
   filter(!str_detect(x_col, "c4"))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading