grep using a character vector with multiple patterns

前端 未结 10 2337
猫巷女王i
猫巷女王i 2020-11-22 04:29

I am trying to use grep to test whether a vector of strings are present in an another vector or not, and to output the values that are present (the matching pat

10条回答
  •  灰色年华
    2020-11-22 05:24

    Take away the spaces. So do:

    matches <- unique(grep("A1|A9|A6", myfile$Letter, value=TRUE, fixed=TRUE))
    

提交回复
热议问题