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.
In R, using gregmisc
, I could do
balls<-c('orange','orange', 'green', 'green','green','yellow'...'yellow')
and then just do
g <- permutations(length(balls),length(balls),v=balls,set=F)
g.reduced <- g[!duplicated(g),]
But that seems very unnecessary.