title: Which files have some content in R
body: <p>I have a list which contain lines of files, sample of which is shown. </p>
  
  <pre><code>list(c("\"ID\",\"SIGNALINTENSITY\",\"SNR\"", "\"NM_012429\",\"7.19739265676517\",\"0.738130599770152\"", 
  "\"NM_003980\",\"12.4036181424743\",\"13.753593768862\"", "\"AY044449\",\"8.74973537284918\",\"1.77200602833912\"", 
  "\"NM_005015\",\"11.3735054810744\",\"6.76079815107347\""), c("\"ID\",\"SIGNALINTENSITY\",\"SNR\"", 
  "\"NM_012429\",\"7.07699512126353\",\"0.987579612646805\"", "\"NM_003980\",\"11.3172936656653\",\"8.38227473088534\"", 
  "\"AY044449\",\"9.2865464417786\",\"2.61149606120517\"", "\"NM_005015\",\"10.1228142794354\",\"3.98707517627092\""
  ), c("ID,SIGNALINTENSITY,SNR", "1,NM_012429,6.44764696592035,0.84120306786724", 
  "2,NM_003980,9.52604513443066,3.02404186191898", "3,AY044449,9.11930818670925,2.24361163736047", 
  "4,NM_005015,10.5672879852575,5.29334273442728"))
  </code></pre>
  
  <p>I want to confirm the match when reading lines. I tried to find out which files has content starting with <code>NM</code> or <code>GE</code> by the following code</p>
  
  <pre><code>which(lapply(lines, function(x) any(grepl(paste(c("^NM_","^GE"),collapse = "|"), x, ignore.case = TRUE))) == T)
  </code></pre>
  
  <p>which is supposed to give index of all the three, but it return <code>integer(0)</code>. I am not sure what I am missing.</p>