I would be generate a combinations of a vector x of 5 element with at most 2 repetitions for each element.
x = c(1,2,3,4,5,6,7,8,9,10)
I'm using combn(x,5) but return the combination of 5 element without repetition.
In output I would be like : ((1,2,3,4,5), (1,2,3,4,6), ..., (1,1,3,4,5),(1,2,3,4,4), (1,1,2,2,3), ...)
Most important thing is that each element is represented at most twice. I would like to know if there is a function that can do this.