generate.perms: Generate all possible permutations of k elements out of n

Description Usage Arguments Value Author(s) See Also Examples

Description

This function generates all permutations of n elements taken k at a time. The most efficient way to generate n! permutations of vec in a Lexicographic order without recursive algorithm in R.

Usage

1
generate.perms(n, k = n, vec = 1:n)

Arguments

n

number of the whole elements

k

number of elements to permute (default the same as n)

vec

the source vector of length n (default as c(1:n))

Value

a matrix or a vector, each row is a permutation

Author(s)

Li Qinglong <liqinglong0830@163.com>

See Also

generate.combn

Examples

1

StatMethRank documentation built on Jan. 15, 2017, 8:59 p.m.