Learn R Programming

seriation (version 1.4.1)

ser_permutation_vector: Class ser_permutation_vector -- A Single Permutation Vector for Seriation

Description

The class ser_permutation_vector represents a single permutation vector.

Usage

ser_permutation_vector(x, method = NULL)

# S3 method for ser_permutation_vector c(..., recursive = FALSE)

# S3 method for ser_permutation_vector rev(x)

get_method(x, printable = FALSE)

# S3 method for ser_permutation_vector length(x)

# S3 method for ser_permutation_vector print(x, ...)

# S3 method for ser_permutation_vector summary(object, ...)

Value

An object of class ser_permutation_vector.

Arguments

x, object

an object which contains a permutation vector (currently an integer vector or an object of class hclust). The value NA creates an identity permutation.

method

a string representing the method used to obtain the permutation vector.

...

further arguments.

recursive

ignored

printable

a logical; prints "unknown" instead of NULL for non-existing methods.

Author

Michael Hahsler

Details

A permutation vector maps a set of \(n\) objects \(\{O_1, O_2, ..., O_n\}\) onto itself.

Ordering Representation: In seriation we represent a permutation \(\pi\) as a vector which lists the objects' indices in their permuted order. This can be seen as replacing the object in position \(i\) with the object in position \(\pi(i)\). For example, the permutation vector \(\langle3, 1, 2\rangle\) indicates that in first position is the object with index 3 then the object with index 1 and finally the object with index 2. This representation is often called a (re)arrangement or ordering. The ordering can be extracted from a permutation vector object via get_order(). Such an ordering can be directly used to subset the list of original objects with "[" to apply the permutation.

Rank Representation: An alternative way to specify a permutation is via a list of the ranks of the objects after permutation. This representation is often called a map or substitution. Ranks can be extracted from a permutation vector using get_rank().

Permutation Matrix: Another popular representation is a permutation matrix which performs permutations using matrix multiplication. A permutation matrix can be obtained using get_permutation_matrix().

ser_permutation_vector objects are usually packed into a ser_permutation object which is a collection (a list) of \(k\) permutation vectors for \(k\)-mode data.

The constructor ser_permutation_vector() checks if the permutation vector is valid (i.e. if all integers occur exactly once).

See Also

Other permutation: get_order(), permutation_vector2matrix(), permute(), ser_dist(), ser_permutation()

Examples

Run this code
p <- ser_permutation_vector(sample(10), "random")
p

## some methods
length(p)
get_method(p)
get_order(p)
get_rank(p)
get_permutation_matrix(p)

r <- rev(p)
r
get_order(r)

## create a identity permutation vector (with unknown length)
ip <- ser_permutation_vector(NA)
ip

Run the code above in your browser using DataLab