R: Registry for Seriation Methods

seriation_methods {seriation} | R Documentation

## Registry for Seriation Methods

### Description

A registry to manage methods for seriation.

### Usage

    list_seriation_methods(kind)
    show_seriation_methods(kind)
    get_seriation_method(kind, name)
    set_seriation_method(kind, name, definition, description = NULL, ...)

### Arguments

`kind` | the data type the method works on. For example, `"dist"`, `"matrix"` or `"array"`.
`name` | a short 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.
`...` | further information that is stored for the method in the registry.

### 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`). The result is a vector of character strings with the short names of the methods.

`show_seriation_method()` shows all available methods including a description.

`get_seriation_method()` returns information (including the implementing function) about a given method in form of an object of class `"seriation_method"`.

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`.

### Author(s)

Michael Hahsler

### Examples

    ## registry
    registry_seriate

    ## convenience functions
    show_seriation_methods("matrix")

    list_seriation_methods("matrix")

    get_seriation_method("matrix", "BEA")

    ## define a new method

    ## create a identity function which returns the identity order
    seriation_method_identity <- function(x, control) {
       lapply(dim(x), seq)
    }

    ## set new method
    set_seriation_method("matrix", "identity", seriation_method_identity,
        "Identity order")

    set_seriation_method("array", "identity", seriation_method_identity,
        "Identity order")

    show_seriation_methods("matrix")

    ##use all criterion methods (including the new one)
    seriate(matrix(1:12, ncol=3), "identity")

[Package seriation version 1.2-7 Index]