I have a vector with different values (the length of the vector is an even number). Let k = c (1,2,3,4).
I want to split k into pairs and list all possible unique combinations of pairs without replacement. Each result should be a list containing k / 2 different unique pairs. In addition, list items (i.e., Pairs) must differ in terms of identity and order.
So, in the above example, the results should be as follows. (Ideally, all results will be in the list of lists, each of which contains one unique partition)
result 1: pair1 = 1,2; pair2 = (3.4)
result 2: pair1 = 1.3; pair2 = (2,4)
result 3: pair1 = 1.4; pair2 = (2,3)
So, the result is (2.1); (3.4) and (3.4); (1,2) are invalid because they are identical to result 1 above.
Note that I need not only to find all combinations of pairs, like combn (from combinat). I need to divide the vector k into all pairs.
Also for this reason, this question is not a duplicate of any question relating to finding pairs only (without placing / dividing a vector).
For my needs, k will be 14, so there are many possibilities.
You know how I can approach the problem. I work with R.
thanks