An easy one for many of you, I'm sure, which will save my day : I need to generate a permutation set of all the pairs of a sequence of numbers. For example, for 1:6, it will give as a final result, 30 subsets, i.e. n(n-1) :
(1,2),(3,4),(5,6)
...
(1,6),(2,3),(4,5)
I need pairs, not couples, so that (3,4) and (4,3) is an unique pair.
combn(1:6,2)
gives me a table with my pairs as columns, but how do I produce my list of pairs out of it?
combn(1:6,2)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15]
[1,] 1 1 1 1 1 2 2 2 2 3 3 3 4 4 5
[2,] 2 3 4 5 6 3 4 5 6 4 5 6 5 6 6
Thank you