Recursively apply a permutation
Recursively apply a permutation to a vector an arbitrary number of times. Negative times mean apply the inverse permutation.
recurse(perm, i, start = seq_along(perm))
perm |
Permutation (integers 1 to |
start |
Start vector to be permuted |
i |
Number of times to apply the permutation. |
Robin K. S. Hankin
n <- 15 noquote(recurse(start=letters[1:n],perm=shift(1:n),i=0)) noquote(recurse(start=letters[1:n],perm=shift(1:n),i=1)) noquote(recurse(start=letters[1:n],perm=shift(1:n),i=2)) noquote(recurse(start=letters[1:n],perm=sample(n),i=1)) noquote(recurse(start=letters[1:n],perm=sample(n),i=2))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.