Learn R Programming

shallot (version 0.4.1)

permutation: Permutation

Description

These function define a permutation for subsequent use.

Usage

permutation(..., n.items = NULL, fixed = TRUE)
# S3 method for shallot.permutation
print(x, ...)

Arguments

...

For the function permutation, a permutation of the integers 1, 2,... n, where n is the length of the vector. For the function print.shallot.permutation, this is ignored.

n.items

An optional argument provided instead of ... to request a random partition. The argument fixed must be FALSE.

x

An object of class shallot.permutation.

fixed

Should the permutation be fixed?

Value

An object of class shallot.permutation.

Details

A valid permutation of length n is an integer vector of length n containing each integer 1, 2,... n only once.

References

Dahl, D. B., Day, R., and Tsai, J. (2017), Random Partition Distribution Indexed by Pairwise Information, Journal of the American Statistical Association, accepted. <DOI:10.1080/01621459.2016.1165103>

See Also

attraction

Examples

Run this code
# NOT RUN {
## Demonstrate permutation.
permutation(c(3, 1, 2, 5, 4))
permutation(c(3, 1, 2, 5, 4), fixed=FALSE)
permutation(n.items=5, fixed=FALSE)
# }

Run the code above in your browser using DataLab