Frage

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)
War es hilfreich?

Lösung

Try using permn from combinat package

library(combinat)
permn(myVect)

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top