Learn R Programming

magic (version 1.3-20)

recurse: Recursively apply a permutation

Description

Recursively apply a permutation to a vector an arbitrary number of times. Negative times mean apply the inverse permutation.

Usage

recurse(start = 1:n, perm, i)

Arguments

start
Start vector to be permuted
perm
Permutation (integers 1 to length(start) in some order)
i
Number of times to apply the permutation. i=0 gives start by definition

See Also

hudson

Examples

Run this code
recurse(start=rnorm(10),perm=sample(10),i=3)

Run the code above in your browser using DataLab