title: Select the first row by group
body: <p>From a dataframe like this</p>
  
  <pre><code>test &lt;- data.frame('id'= rep(1:5,2), 'string'= LETTERS[1:10])
  test &lt;- test[order(test$id), ]
  rownames(test) &lt;- 1:10
  
  &gt; test
      id string
   1   1      A
   2   1      F
   3   2      B
   4   2      G
   5   3      C
   6   3      H
   7   4      D
   8   4      I
   9   5      E
   10  5      J
  </code></pre>
  
  <p>I want to create a new one with the first row of each id / string pair. If sqldf accepted R code within it, the query could look like this:</p>
  
  <pre><code>res &lt;- sqldf("select id, min(rownames(test)), string 
                from test 
                group by id, string")
  
  &gt; res
      id string
   1   1      A
   3   2      B
   5   3      C
   7   4      D
   9   5      E
  </code></pre>
  
  <p>Is there a solution short of creating a new column like</p>
  
  <pre><code>test$row &lt;- rownames(test)
  </code></pre>
  
  <p>and running the same sqldf query with min(row)?</p>