title: Using grep to help subset a data frame
body: <p>I am having trouble subsetting my data.  I want the data subsetted on column x, where the first 3 characters begin G45.</p>
  <p>My data frame:</p>
  <pre><code>x &lt;- c(&quot;G448&quot;, &quot;G459&quot;, &quot;G479&quot;, &quot;G406&quot;)  
  y &lt;- c(1:4)
  My.Data &lt;- data.frame (x,y)
  </code></pre>
  <p>I have tried:</p>
  <pre><code>subset (My.Data, x==&quot;G45*&quot;)
  </code></pre>
  <p>But I am unsure how to use wildcards.  I have also tried grep() to find the indicies:</p>
  <pre><code>grep  (&quot;G45*&quot;, My.Data$x)
  </code></pre>
  <p>but it returns all 4 rows, rather than just those beginning G45, probably also as I am unsure how to use wildcards.</p>