title: combn-like task for combinations as elements in R
body: <p>not sure if I chose a good title at all... Also I don't know if I use the right terminology, so maybe with the right search terms I would find a solution to this problem... </p>
  
  <p>I have a list of strings from which I want to have all sets of "exclusive" combinations of 3.</p>
  
  <p>Example:
  With the following</p>
  
  <pre><code>require(utils)
  mylist&lt;-c("strA","strB","strC","strD","strE","strF")
  t(combn(mylist,3))
  </code></pre>
  
  <p>I get a table that lists all possible combinations of 3 out of those 6 strings (so each row represents one combination of 3):</p>
  
  <pre><code>        [,1]   [,2]   [,3]  
     [1,] "strA" "strB" "strC"
     [2,] "strA" "strB" "strD"
     [3,] "strA" "strB" "strE"
     [4,] "strA" "strB" "strF"
     [5,] "strA" "strC" "strD"
     [6,] "strA" "strC" "strE"
     [7,] "strA" "strC" "strF"
     [8,] "strA" "strD" "strE"
     [9,] "strA" "strD" "strF"
    [10,] "strA" "strE" "strF"
    [11,] "strB" "strC" "strD"
    [12,] "strB" "strC" "strE"
    [13,] "strB" "strC" "strF"
    [14,] "strB" "strD" "strE"
    [15,] "strB" "strD" "strF"
    [16,] "strB" "strE" "strF"
    [17,] "strC" "strD" "strE"
    [18,] "strC" "strD" "strF"
    [19,] "strC" "strE" "strF"
    [20,] "strD" "strE" "strF"
  </code></pre>
  
  <p>but I would like to have all sets of combinations of 3, in which each string only appears once. So my desired output would look sth like this:</p>
  
  <pre><code>$1
          [,1]   [,2]   [,3]  
     [1,] "strA" "strB" "strC"
     [2,] "strD" "srtE" "strF"
  $2
          [,1]   [,2]   [,3]  
     [1,] "strA" "strB" "strD"
     [1,] "strC" "strE" "strF"
  $3
          [,1]   [,2]   [,3]  
     [1,] "strA" "strB" "strE"
     [1,] "strC" "strD" "strF"
  ...
  </code></pre>
  
  <p>So here each subelement (<code>$1</code>, <code>$2</code>, <code>$3</code>, etc.) contains 2 combinations of 3 strings (as 2*3=6; with 6 strings). In each set each string must not appear more than once. </p>
  
  <p>Of course it would be great if this would be also possible for lengths of <code>mylist</code> that are not a multiple of <code>n=3</code>. In case we have let's say 10 strings (with the addition of "strG", "strH", "strI", and "strJ"), I would like to have one string ommitted in each combination. So the desired result would be sth like</p>
  
  <pre><code>$1
          [,1]   [,2]   [,3]  
     [1,] "strA" "strB" "strC"
     [2,] "strD" "strE" "strF"
     [3,] "strG" "strH" "strI"
  $2
          [,1]   [,2]   [,3]  
     [1,] "strA" "strB" "strC"
     [2,] "strD" "strE" "strF"
     [3,] "strG" "strH" "strJ"
  $3
          [,1]   [,2]   [,3]  
     [1,] "strA" "strB" "strC"
     [2,] "strD" "strE" "strF"
     [3,] "strG" "strI" "strJ"
  $4
          [,1]   [,2]   [,3]  
     [1,] "strA" "strB" "strC"
     [2,] "strE" "strF" "strG"
     [3,] "strH" "strI" "strJ"
  ...
  </code></pre>
  
  <p>Does someone have a solution to this?
  If my explanation was unclear, please let me know.</p>
  
  <p>Cheers</p>