title: Detecting rows with same elements in different order
body: <p>I need to make a matrix/data frame containing all combinations of the elements in two vectors.  All combinations must be unique, and include different elements.  I know I can use the following to make a list of all combinations:</p>
  
  <pre><code>a&lt;-c("cat","dog","cow")
  b&lt;-c("dog","cow","sheep")
  combination&lt;-as.matrix(expand.grid(a,b))
  </code></pre>
  
  <p>And that I can remove entries where both elements are the same using this:</p>
  
  <pre><code>combination1&lt;-combination[combination[,1]!=combination[,2],]
  </code></pre>
  
  <p>Which gives the following output:</p>
  
  <pre><code>&gt; combination1
       Var1  Var2   
  [1,] "cat" "dog"  
  [2,] "cow" "dog"  
  [3,] "cat" "cow"  
  [4,] "dog" "cow"  
  [5,] "cat" "sheep"
  [6,] "dog" "sheep"
  [7,] "cow" "sheep"
  </code></pre>
  
  <p>What I need is to detect/remove rows with the same strings, but in a different order (rows 2 and 4 are "cow,dog", and "dog,cow".  Is there a simple way to do this in R?  I'm writing a script to test interactions between genes in barley which is very lengthy, and I want to avoid testing the same combination twice.  Any help would be appreciated.</p>