title: Group-by operation for another column R
body: <p>I'm looking to perform operations for one column based on grouping for another column.</p>
  <p>Say I have the following data:</p>
  <pre><code>user &lt;- c(1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3)
  score &lt;- c(1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1)
  time_1 &lt;- c(130, NA, 120, 245, NA, NA, NA, 841, NA, NA, 721, 612)
  time_2 &lt;- c(NA, 742, NA, NA, 812, 212, 214, NA, 919, 528, NA, NA)
  df &lt;- data.frame(user, score, time_1, time_2) 
  </code></pre>
  <p>We get the following df:</p>
  <pre><code>   user score time_1 time_2
      1     1    130     NA
      1     0     NA    742
      1     1    120     NA
      1     1    245     NA
      2     0     NA    812
      2     0     NA    212
      2     0     NA    214
      2     1    841     NA
      3     0     NA    919
      3     0     NA    528
      3     1    721     NA
      3     1    612     NA
  </code></pre>
  <p>For every user 1, what is the smallest value of <code>time_1</code>?
  So I am looking to group users by their number, and perform an operation on column <code>time_1</code>.</p>