Learn R Programming

permutations (version 1.1-5)

derangement: Tests for a permutation being a derangement

Description

A derangement is a permutation which leaves no element fixed.

Usage

is.derangement(x)

Value

A vector of Booleans corresponding to whether the permutations are derangements or not.

Arguments

x

Object to be tested

Author

Robin K. S. Hankin

See Also

id

Examples

Run this code

allperms(4)
is.derangement(allperms(4))

M <- matrix(c(1,2,3,4, 2,3,4,1, 3,2,4,1),byrow=TRUE,ncol=4)
M
is.derangement(word(M))

is.derangement(rperm(16,4))

Run the code above in your browser using DataLab