title: Matching non-sequential combinations of strings in R and collapsing data frame based on combos
body: <p>I have data like this:</p>
  
  <pre><code>table &lt;- data.frame(col1 = c("USA", "CHN", "DEU", "DEU"), col2 = c("DEU", "DEU", "USA", "CHN"), col3 = c(100, 150, 300, 250))
  
    col1 col2 col3
  1  USA  DEU  100
  2  CHN  DEU  150
  3  DEU  USA  300
  4  DEU  CHN  250
  </code></pre>
  
  <p>How do I collapse this table based on the combination of values in col1 and col2 independent of the sequence of this combination -- so that I have the following table?</p>
  
  <pre><code>  col1 col2 col3
  1  USA  DEU  400
  2  CHN  DEU  400
  </code></pre>
  
  <p>Many thanks for any advice you could provide</p>
  
  <p>UPDATE: See updated data here:</p>
  
  <pre><code>AUS AUS 431.92164
  AUS AUS 581.14942
  AUS AUS 1822.10345
  AUS AUS 1024.4436
  AUS AUS 126.45221
  AUS AUS 171.01716
  AUS AUS 432.23415
  AUS AUS 35.28675
  AUS AUS 1488.02559
  AUS AUS 0
  AUS AUS 9057.73836
  AUS AUS 9933.79762
  AUS AUS 4307.49845
  AUS AUS 73.33633
  AUT AUT 1089.27094
  AUT AUT 413.83978
  AUT AUT 118.46822
  AUT AUT 3700.34366
  </code></pre>