title: For first occurence of value in a column record minimum value from a different column
body: <p>I have a data frame 'all', a subset of which looks like this</p>
  <pre><code>ONSETS_S    DURATIONS_S CUMUlATIVE_DURATION Phase Active  Block   TRIAL
  0           2.926       2.926               1     NA      NA       NA
  2.926       1.925       4.851               1     NA      NA       NA
  4.851       4.851       9.702               1     Passive Baseline 1
  9.702       1.54        11.242              1     Passive Baseline 1
  11.242      4.851       16.093              1     Passive Baseline 1
  107.183     1.925       109.109             1     NA      NA       NA
  109.108     4.851       113.96              1     Active  Baseline 1
  114.135     1.848       115.808             1     Active  Baseline 1
  115.807     4.851       120.659             1     Active  Baseline 1
  312.232     1.925       314.16              1     NA      NA       NA
  314.157     4.851       319.011             1     Passive Baseline 1
  319.008     2.387       321.398             1     Passive Baseline 1
  321.395     4.851       326.249             1     Passive Baseline 1
  415.797     1.925       417.725             1     NA      NA       NA
  417.722     4.851       422.576             1     Active  GD       2
  422.762     2.31        424.886             1     Active  GD       2
  424.883     4.851       429.737             1     Active  GD       2
  </code></pre>
  <p>In the whole data frame there are total 6 phases, 5 types of entries in Block and up to 2 trials per block per phase. I want to create a matrix of minimum values in ONSETS_S for each Trial, when when Phase, Active and Block condition values are fixed.
  For example, when <code>Phase == 1 &amp; Active == &quot;Passive&quot; &amp; Block == &quot;Baseline&quot;</code> the output should be <code>P_1_Passive_Onsets &lt;- [4.851 314.157]</code></p>