Remove groups that contain certain strings

前端 未结 4 2091
孤城傲影
孤城傲影 2021-01-19 15:15

I have an issue about removing the groups that contain certain strings in its rows for example if includes .. I would like to achive this without breaking the p

4条回答
  •  半阙折子戏
    2021-01-19 15:22

    Another option could be using %in% operator.

    df %>% 
     filter(!(gr %in% unique(ifelse(grepl("\\.",vals),gr,NA) )))
    
    #  vals gr
    #1 good  1
    #2  bad  1
    #3 ugly  1
    

提交回复
热议问题