permutation: Permutations

View source: R/permutation.R

permutationR Documentation

Permutations

Description

Gets a permutation of the integers 1-N by its index 1-N!.

Usage

permutation(x, n)

Arguments

x

number (length 1 vector). The index of the permutation to generate. Must be less than factorial(n)

n

number (length 1 vector). The number of items in the permutation.

Value

Number vector of the integers 1-n re-ordered.

Examples

for (i in 1:24) print(permutation(i, 4))

graywh/r-gmisc documentation built on April 19, 2023, 1:42 p.m.