A registry to manage methods used by seriate().
data
Format
An object of class seriation_registry (inherits from registry) of length 58.
registry_seriate
list_seriation_methods(kind, names_only =TRUE)get_seriation_method(kind, name)set_seriation_method( kind, name, definition, description =NULL, control = list(), randomized =FALSE, optimizes =NA_character_, verbose =FALSE,...)## S3 method for class 'seriation_method'print(x,...)
Arguments
kind: the data type the method works on. For example, "dist", "matrix" or "array". If missing, then methods for any type are shown.
names_only: logical; return only the method name. FALSE returns also the method descriptions.
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.
randomized: logical; does the algorithm use randomization and re-running the algorithm several times will lead to different results (see: seriate_rep()).
optimizes: what criterion does the algorithm try to optimize (see: list_criterion_methods()).
verbose: logical; print a message when a new method is registered.
...: further information that is stored for the method in the registry.
x: an object of class "seriation_method" to be printed.
Returns
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".
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 and, for arrays and matrices margin, where x is the data object and control contains a list with additional information for the method passed on from seriate(), and margin is a vector specifying what dimensions should be seriated. 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.
Examples
# Registryregistry_seriate
# List all seriation methods by typelist_seriation_methods()# List methods for matrix seriationlist_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: Reverse the row order# (NA means no seriation is applied to columns)seriation_method_reverse_rows <-function(x, control =NULL, margin = c(1,2)){ list(rev(seq(nrow(x))),NA)[margin]}# 2. Register new methodset_seriation_method("matrix","Reverse_rows", seriation_method_reverse_rows, description ="Reverse identity order", control = list())list_seriation_methods("matrix")get_seriation_method("matrix","reverse_rows")# 3. Use the new seriation methodsseriate(matrix(1:12, ncol =3),"reverse_rows")
See Also
This registry uses registry::registry .
Other seriation: register_DendSer(), register_GA(), register_optics(), register_smacof(), register_tsne(), register_umap(), seriate(), seriate_best()