0

The question is similar my last post Combinatorially rearrange the contents of list values in R. t(sapply(x, function(u) c(u, setdiff(x, u)))) provides needed result.

But how to do binary permutations, i.e. so that the result is something like this? On input the list (matches in pairs and not with all values in the list)

x <- c("d1","d2","d3","d4","d5")

as output (binary comparisons one against the other, i.e. if it done manually it would look like this)

d1,d2
d1,d3
d1,d4
d1,d5
d2,d3
d3,d4
d3,d5
d4,d5
psysky
  • 3,037
  • 5
  • 28
  • 64

0 Answers0