문제

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)
도움이 되었습니까?

해결책

Try using permn from combinat package

library(combinat)
permn(myVect)

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top