grep using a character vector with multiple patterns

前端 未结 10 2336
猫巷女王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:25

    Not sure whether this answer has already appeared...

    For the particular pattern in the question, you can just do it with a single grep() call,

    grep("A[169]", myfile$Letter)
    

提交回复
热议问题