lexicographicPermutation: Generate the n:th lexicographic permutation of a vector

Description Usage Arguments Value Author(s) See Also Examples

Description

Generate the n:th lexicographic permutation of a vector. The 0:th permutation is the non-permuted vector. The last permutation is the (n-1):th. If the vector is of length N, there are N! permutation.

Usage

1
2
## Default S3 method:
lexicographicPermutation(x, n, ...)

Arguments

x

The vector from which the permutation should be generated.

n

An integer between 0 and N!-1, where N is the length of the vector. If n==0 the non-permutated vector is returned.

...

Not used.

Value

Returns a permuted vector of the same length as the input vector.

Author(s)

Henrik Bengtsson

See Also

See lexicographicPermutations() to generate all lexicographic permutations of a vector. See permutations() for a wrapper function to generate different types of permutations. See x[sample(n)] to generate a random permutation.

Examples

1
## Not run: See help(lexicographicPermutations) for an example.

HenrikBengtsson/R.basic documentation built on May 6, 2019, 11:51 p.m.