title: how to use grep in R to select the correct id from a query
body: <p>I am trying to use <code>grep</code> in R to select the correct id from a huge list of id's. It works for most of them but not for others. For example when i use this</p>
  
  <pre><code>&gt; grep("cp_gi_88656873.2", names(data), value = T)
  [1] "cp_gi_88656873.2"  "cp_gi_88656873.29"
  </code></pre>
  
  <p>it is giving me two id's rather than one. To make this more stringent i am adding a <code>$</code> to the end of the query and it works ok</p>
  
  <pre><code>&gt; grep("cp_gi_88656873.2$", names(data), value = T)
  [1] "cp_gi_88656873.2"
  </code></pre>
  
  <p>Is there other ways around to solve this problem without adding <code>$</code> to the end of id's? I ask this i have several hundred id's and i have to add <code>$</code> to each one of them.</p>