title: How to generate all possible combinations of vectors without caring for order?
body: <p>In a data frame, I have one column containing character strings. Let's say it looks like this:</p>
  
  <pre><code>x &lt;- unique(df[,1])
  x
  "A" "A" "B" "B" "B" "C"
  </code></pre>
  
  <p>I'd like to get all possible combinations of the unique character strings as sets of 2 without caring about their order, so <code>A, B</code> is the same as <code>B, A</code>, and I don't want to get same values as combination like <code>A, A</code>. So far, I got until this point:</p>
  
  <pre><code>comb &lt;- expand.grid(x, x)
  comb &lt;- comb[which(comb[,1] != comb[,2]),]
  </code></pre>
  
  <p>But this still leaves the problem of having rows with the same combination of strings in a different order. How do I get rid of this?</p>