Delete rows containing specific strings in R

前端 未结 6 1609
暖寄归人
暖寄归人 2020-11-27 11:34

I would like to exclude lines containing a string \"REVERSE\", but my lines do not match exactly with the word, just contain it.

My input data frame:



        
6条回答
  •  日久生厌
    2020-11-27 12:01

    This should do the trick:

    df[- grep("REVERSE", df$Name),]
    

    Or a safer version would be:

    df[!grepl("REVERSE", df$Name),]
    

提交回复
热议问题