# 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
# (with margin since it is for arrays; NA means no seriation is applied)
seriation_method_reverse <- function(x, control = NULL,
margin = seq_along(dim(x))) {
lapply(seq_along(dim(x)), function(i)
if (i %in% margin) rev(seq(dim(x)[i]))
else NA)
}
# 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