title: How to generate all combinations of a vector
body: <p>Say I have 3 green balls, 2 orange balls, and 8 yellow balls. I want to order them, how can I generate all possible sequences given that all balls of the same color are identical. </p>
  
  <p>In R, using <code>gregmisc</code>, I could do </p>
  
  <pre><code>balls&lt;-c('orange','orange', 'green', 'green','green','yellow'...'yellow')
  </code></pre>
  
  <p>and then just do </p>
  
  <pre><code>g &lt;- permutations(length(balls),length(balls),v=balls,set=F)
  g.reduced &lt;- g[!duplicated(g),]
  </code></pre>
  
  <p>But that seems very unnecessary.</p>