title: how do I grep in R?
body: <p>I would like to choose rows based on the subsets of their names, for example</p>
  
  <p>If I have the following data:</p>
  
  <pre><code>data &lt;- structure(c(91, 92, 108, 104, 87, 91, 91, 97, 81, 98), 
  .Names = c("fee-", "fi", "fo-", "fum-", "foo-", "foo1234-", "123foo-", 
  "fum-", "fum-", "fum-"))
  </code></pre>
  
  <p>how do I select the rows matching 'foo'?</p>
  
  <p>using grep() doesn't work:</p>
  
  <pre><code> grep('foo', data)
  </code></pre>
  
  <p>returns:</p>
  
  <pre><code>integer(0)
  </code></pre>
  
  <p>what am I doing wrong? or, is there a better way?</p>
  
  <p>Thanks!</p>