title: Select a value for based on a highest value in another column
body: <p>I don't understand why I can't find a solution for this, since I feel that this is a pretty basic question. Need to ask for help, then. I want to rearrange airquality dataset by month with maximum temp value for each month. In addition I want to find the corresponding day for each monthly maximum temperature. What is the laziest (code-wise) way to do this?</p>
  
  <p>I have tried following without a success:</p>
  
  <pre><code>require(reshape2)
  names(airquality) &lt;- tolower(names(airquality))
  mm &lt;- melt(airquality, id.vars = c("month", "day"), meas = c("temp"))
  
  dcast(mm, month + day ~ variable, max)
  aggregate(formula = temp ~ month + day, data = airquality, FUN = max)
  </code></pre>
  
  <p>I am after something like this:</p>
  
  <pre><code>month day temp
  5     7    89
  ...
  </code></pre>