title: grep subset index referencing
body: <p>Say I have a list in R</p>
  
  <pre><code>alist&lt;-c("a","a","b","c")
  </code></pre>
  
  <p>now I want to take a subset of that list <code>alist[c(2,3,4)]</code></p>
  
  <p>if I apply the <code>grep</code> function to the subset i.e. </p>
  
  <pre><code>grep("b",alist[c(2,3,4)]) 
  </code></pre>
  
  <p>I will get 2. Is there anyway to use the <code>grep</code> function so that I get the position of <code>b</code> in the original list and not the subset? So instead of 2 the <code>grep</code> function will return 3?</p>