Nothing
#######################################################################
# seriation - Infrastructure for seriation
# Copyright (C) 2011 Michael Hahsler, Christian Buchta and Kurt Hornik
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
## Criterion for the quality of a permutation of a array
.criterion_array_helper <-
function(x,
order = NULL,
method = NULL,
datatype = "array",
force_loss = FALSE)
{
## check order
if (!is.null(order)) {
if (!inherits(order, "ser_permutation"))
stop("Argument 'order' has to be of class 'ser_permutation'.")
.check_matrix_perm(x, order)
}
## get methods
if (is.null(method))
method <- list_criterion_methods(datatype)
method <-
lapply(method, function(m)
get_criterion_method(datatype, m))
crit <- sapply(method,
function(m)
structure(m$fun(x, order), names = m$name))
if (force_loss)
crit <- crit * sapply(
method,
FUN =
function(m)
((as.integer(m$merit) * -2) + 1)
)
crit
}
#' @rdname criterion
#' @export
criterion.array <-
function(x,
order = NULL,
method = NULL,
force_loss = FALSE,
...)
.criterion_array_helper(x, order, method, "array", force_loss)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.