Learn R Programming

lmPerm (version 2.1.0)

permute: Permutation Generation

Description

Generates permutations a pair at a time.

Usage

permute(N=4,K=1,initialize=0)

Arguments

N
The number of elements in the permutation vector. The elements are numbered 1:N
K
The number of exchange pairs to be returned at each access
initialize
Set to 1 to initialize. Set to 0 for additional pairs.

Value

Details

On first call, set initialize to 1. On subsequent accesses, initialize should be 0. The function returns at most K exchange pairs at each access. The function should be repeatedly called until result is false.

The function returns a list.

References