title: Select most recent date, by row in R
body: <p>I have a problem that I have reduced to the following task. For a dataframe with IDs and dates;</p>
  
  <pre><code>set.seed(123)
  myids &lt;- sample(c('a001', 'a002', 'a003'), 12, replace = TRUE)
  mydates &lt;- as.Date(sample(c("2007-06-22", "2004-02-13", "2007-05-22", "2001-10-10", "2008-05-05", "2004-02-15"), 12, replace = TRUE))
  mydf &lt;- data.frame(myids, mydates)
  </code></pre>
  
  <p>I need to select only the row with the most recent date, for each subject. The result should be:</p>
  
  <pre><code>a001    5/5/08
  a002    5/5/08
  a003    2/15/04
  </code></pre>
  
  <p>Anyone know how to do this?</p>