permn: Generate All Permutations of n Elements

View source: R/permn.R

permnR Documentation

Generate All Permutations of n Elements

Description

Generates all n! vectors of length n consisting of permutations of the integers 1 to n.

Usage

permn(n)

Arguments

n

Number of elements.

Details

Adapted from the "permutations" function in the e1071 R package.

Value

Matrix of dimension n by n! where each column contains a unique permutation vector.

Warning

For large n this function will consume a lot of memory and may even crash R.

Note

Used for exact tests in np.cor.test and np.reg.test.

Author(s)

Nathaniel E. Helwig <helwig@umn.edu>

References

Meyer, D., Dimitriadou, E., Hornik, K., Weingessel, A., & Leisch, F. (2018). e1071: Misc Functions of the Department of Statistics, Probability Theory Group (Formerly: E1071), TU Wien. R package version 1.7-0. https://CRAN.R-project.org/package=e1071

Examples

permn(2)
permn(3)

nptest documentation built on April 15, 2023, 1:08 a.m.