Learn R Programming

seriation (version 1.4.1)

registry_seriate: Registry for Seriation Methods

Description

A registry to manage methods used by seriate().

Usage

registry_seriate

list_seriation_methods(kind)

get_seriation_method(kind, name)

set_seriation_method( kind, name, definition, description = NULL, control = list(), ... )

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

Value

  • list_seriation_method() result is a vector of character strings with the names of the methods. These names are used for methods in seriate().

  • get_seriation_method() returns a given method in form of an object of class "seriation_method".

Format

An object of class seriation_registry (inherits from registry) of length 48.

Arguments

kind

the data type the method works on. For example, "dist", "matrix" or "array". If missing, then methods for any type are shown.

name

the name for the method used to refer to the method in seriate().

definition

a function containing the method's code.

description

a description of the method. For example, a long name.

control

a list with control arguments and default values.

...

further information that is stored for the method in the registry.

x

an object of class "seriation_method" to be printed.

Author

Michael Hahsler

Details

The functions below are convenience function for the registry registry_seriate.

list_seriation_method() lists all available methods for a given data type (kind) (e.g., "dist", "matrix"). The result is a vector of character strings with the method names that can be used in function seriate(). If kind is missing, then a list of methods is returned.

get_seriation_method() returns detailed information for a given method in form of an object of class "seriation_method". The information includes a description, parameters and the implementing function.

With set_seriation_method() new seriation methods can be added by the user. The implementing function (definition) needs to have the formal arguments x, control, where x is the data object and control contains a list with additional information for the method passed on from seriate(). The implementation has to return a list of objects which can be coerced into ser_permutation_vector objects (e.g., integer vectors). The elements in the list have to be in corresponding order to the dimensions of x.

See Also

This registry uses registry() in package registry.

Other seriation: register_DendSer(), register_GA(), register_optics(), register_tsne(), register_umap(), seriate()

Examples

Run this code
# Registry
registry_seriate

# List all seriation methods by type
list_seriation_methods()

# List methods for matrix seriation
list_seriation_methods("matrix")

get_seriation_method(name = "BEA")

# Example for defining a new seriation method (reverse identity function for matrix)

# 1. Create the seriation method
seriation_method_reverse <- function(x, control) {
   # return a list of order vectors, one for each dimension
   list(seq(nrow(x), 1), seq(ncol(x), 1))
}

# 2. Register new method
set_seriation_method("matrix", "Reverse", seriation_method_reverse,
    description = "Reverse identity order", control = list())

list_seriation_methods("matrix")
get_seriation_method("matrix", "reverse")

# 3. Use the new seriation methods
seriate(matrix(1:12, ncol=3), "reverse")

Run the code above in your browser using DataLab