Question

Here is a vector:

myVect = c(1,6,3,12,11,15,7,9,19,21)

How can get a list of all possible different vectors we can get by reordering myVect?

one possible way of reordering can be obtained with:

set.seed(12)
sample(myVect)
Was it helpful?

Solution

Try using permn from combinat package

library(combinat)
permn(myVect)

It'll take a while since the number of all possible combinations is 3628800

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top