R/AllGenerics.R

#' Cluster rows of a matrix
#'
#' Cluster rows of a matrix-like object with a variety of algorithms.
#'
#' @param x A numeric matrix-like object where rows represent observations and columns represent variables.
#' @param BLUSPARAM A \linkS4class{BlusterParam} object specifying the algorithm to use.
#' @param full Logical scalar indicating whether the full clustering statistics should be returned for each method.
#'
#' @return
#' By default, a factor of length equal to \code{nrow(x)} containing cluster assignments for each row of \code{x}.
#'
#' If \code{full=TRUE}, a list is returned containing \code{clusters}, a factor as described above;
#' and \code{objects}, an arbitrary object containing algorithm-specific statistics or intermediate objects.
#'
#' @details
#' This generic allows users to write agile code that can use a variety of clustering algorithms.
#' By simply changing \code{BLUSPARAM}, we can tune the clustering procedure in analysis workflows and package functions.
#'
#' @seealso
#' \linkS4class{HclustParam}, \linkS4class{KmeansParam} and \linkS4class{NNGraphParam} 
#' for some examples of values for \code{BLUSPARAM}.
#' 
#' @author Aaron Lun
#'
#' @examples
#' m <- matrix(runif(10000), ncol=10)
#'
#' clusterRows(m, KmeansParam(10L))
#' clusterRows(m, HclustParam())
#' clusterRows(m, NNGraphParam())
#' @export
setGeneric("clusterRows", function(x, BLUSPARAM, full=FALSE) standardGeneric("clusterRows"))

setGeneric(".extras", function(x) standardGeneric(".extras"))

Try the bluster package in your browser

Any scripts or data that you put into this service are public.

bluster documentation built on Nov. 8, 2020, 8:29 p.m.