Methods to exhaustively partition a vector into pairs in R
问题 (This is inspired by another question marked as a duplicate. I think it is an interesting problem though, although perhaps there is an easy solution from combinatorics, about which I am very ignorant.) Problem For a vector of length n , where n mod 2 is zero, find all possible ways to partition all elements of the vector into pairs, without replacement, where order does not matter. For example, for a vector c(1,2,3,4) : list(c(1,2), c(3,4)) list(c(1,3), c(2,4)) list(c(1,4), c(2,3)) My