detecting word boundary with regex in data frame in R

后端 未结 1 727
野性不改
野性不改 2020-12-03 23:15

I have a data.frame named all that has a column of factors, these factors include \"word\",\"nonword\" and some others. My goal is to

相关标签:
1条回答
  • 2020-12-03 23:55

    In R, you need two times \:

    grep("\\bword\\b", all[5])
    

    Alternative solutions:

    grep("^word$", all[5])
    
    which(all[5] == "word")
    
    0 讨论(0)
提交回复
热议问题