permute icon indicating copy to clipboard operation
permute copied to clipboard

Add a `permutations()` function

Open gavinsimpson opened this issue 2 years ago • 1 comments

This would take a supplied vector to be permuted, the control, and the number of permutations, and then return that vector permuted according to each permutation. See #33

gavinsimpson avatar Dec 19 '22 10:12 gavinsimpson

What about the case when all different permutations are not distinct? Say, you have one factor variable and all permutations within factor level are equal. For instance, the Management variable in the dune.env data of vegan has these class counts:

BF HF NM SF 
 3  5  6  6 

which would give

> choose(20,3) * choose(17,5) * choose(12,6)
[1] 6518191680

distinct permutations against formal 20! = 2.43 × 1018.

This has been asked sometimes. On the other hand, having only distinct permutations can be regarded as biased, as these combinations of classes are not equally frequent in terms of free permutation of elements.

jarioksa avatar Dec 19 '22 14:12 jarioksa