title: getting the row name of which.max when doing summarise in ddply
body: <p>I have the following data and want to get the dates when Close is at its max for each Year.</p>
  
  <pre><code>&gt; str(ndvdf)
  'data.frame':   1374 obs. of  2 variables:
   $ Close: num  150 150 150 150 150 ...
   $ Year : num  2009 2009 2009 2009 2009 ...
  &gt; head(ndvdf)
              Close Year
  2010-01-04 150.34 2009
  2010-01-05 150.34 2009
  2010-01-06 150.34 2009
  </code></pre>
  
  <p>I tried the following but the row indices are return rather than dates and the indices are for each yearly subsets so it's difficult to use rownames to get the dates either.</p>
  
  <pre><code>&gt; ddply(ndvdf, .(Year), summarise, MaxDate=which.max(Close))
    Year MaxDate
  1 2009      60
  2 2010     244
  3 2011     245
  </code></pre>
  
  <p>How can I get the dates from my data?
  Thanks.</p>