title: Get row with highest value from one column after chunking with plyr - R
body: <p>Suppose I have a dataframe that looks like this:</p>
  
  <pre><code>   v1 v2 v3 v4 v5 v6
  r1 1  2  2  4  5  9
  r2 1  2  2  4  5  10
  r3 1  2  2  4  5  7
  r4 1  2  2  4  5  12
  r5 2  2  2  4  5  9
  r6 2  2  2  4  5  10
  </code></pre>
  
  <p>I would like to get the row with the highest value in v6 that has the value 1 in v1.
  I know how to get all rows where v1 = 1 and select the first row of that, thanks to <a href="https://stackoverflow.com/a/18694724/1866639">this answer</a> to a previous question:</p>
  
  <pre><code>ddply( df , .variables = "v1" , .fun = function(x) x[1,] )
  </code></pre>
  
  <p>How can I change the function so that I get the row with the highest value in v6?</p>