Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

derangement

Tests for a permutation being a derangement


Description

A derangement is a permutation which leaves no element fixed.

Usage

is.derangement(x)

Arguments

x

Object to be tested

Value

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

Note

The identity permutation is problematic because it potentially has zero size.

The identity element is not a derangement, although the (zero-size) identity cycle and permutation both return TRUE under the natural R idiom all(P != seq_len(size(P))).

Author(s)

Robin K. S. Hankin

See Also

id

Examples

is.derangement(rperm(16,4))

permutations

The Symmetric Group: Permutations of a Finite Set

v1.0-9
GPL-2
Authors
Robin K. S. Hankin [aut, cre] (<https://orcid.org/0000-0001-5982-0415>), Paul Egeler [ctb] (<https://orcid.org/0000-0001-6948-9498>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.