title: Pull min values from dataframe without repeating values in other columns
body: <p>I have a dataframe (<code>df</code>) with 16 rows and 3 columns:</p>
  
  <pre><code>Var1           Var2          value
  1.060579189    1.018186563   0.042392626
  0.020169078    0.119923679  -0.099754601
  1.704759781    1.427241887   0.277517894
  1.060579189    1.427241887  -0.366662698
  1.060579189    0.636595019   0.42398417
  -0.415685797   0.119923679  -0.535609476
  0.020169078    0.636595019  -0.61642594
  1.704759781    1.018186563   0.686573218
  1.060579189    0.119923679   0.94065551
  0.020169078    1.018186563  -0.998017484
  -0.415685797   0.636595019  -1.052280816
  1.704759781    0.636595019   1.068164762
  0.020169078    1.427241887  -1.407072808
  -0.415685797   1.018186563  -1.43387236
  1.704759781    0.119923679   1.584836102
  -0.415685797   1.427241887  -1.842927684
  </code></pre>
  
  <p>The <code>value</code> column is just <code>Var1</code>-<code>Var2</code> sorted by absolute value. I would like to be able to pull the minimum values in the <code>value</code> column on the basis that no values are repeated from either of the first two columns (i.e., the minimum value of <code>value</code> for each unique pair of <code>Var1</code> and <code>Var2</code>). In this example, there would be four values pulled: <code>0.042392626, -0.099754601, 0.277517894, -1.052280816</code>. This is because <code>df[2,4]</code> is a repeat of <code>df[2,3]</code>, but because <code>df[2,3]</code> came first, that is the value that is pulled. Additionally, we have to skip the <code>df[11,3]</code> for the last value because it is the only unique pair left.</p>
  
  <p>Is there an easy way to do this iteratively over the columns and rows of the dataframe? It would make life much easier when I expand this to more complex, longer dataframes.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I managed to hack this together with some trial and error:</p>
  
  <pre><code>fin &lt;- df[1,]
  for (k in 1:nrow(df)) {
    n &lt;- k+1
    if(df[n,1] %in% fin[,'Var1']){
      next
    }
    if(df[n,2] %in% fin[,"Var2"]){
      next
    } else {
      fin[n,] &lt;- df[n,]
    }
  }
  </code></pre>
  
  <p>It certainly isn't the most pretty, and if anyone has any more elegant solutions I'd be happy to hear them and learn something new!</p>