mosaic_labels: Extract a flat partition from a MosaiClusteR result

View source: R/utils-evaluation.R

mosaic_labelsR Documentation

Extract a flat partition from a MosaiClusteR result

Description

Cuts the hierarchical clustering carried in a MosaiClusteR result object into k groups. Works with any method returning a Clust element (an agnes/hclust object) and/or a DistM.

Usage

mosaic_labels(object, k, linkage = "ward")

Arguments

object

A MosaiClusteR result (e.g. from M_ABC), an agnes/hclust object, or a distance matrix.

k

Number of clusters.

linkage

Linkage used when object is a bare distance matrix.

Value

An integer vector of cluster labels, named by object.

Examples

set.seed(1)
s <- paste0("o", 1:20)
L <- list(matrix(rnorm(20 * 40), 20, dimnames = list(s, NULL)),
          matrix(rnorm(20 * 50), 20, dimnames = list(s, NULL)))
fit <- M_ABC(L, numsim = 30)
mosaic_labels(fit, k = 3)

MosaiClusteR documentation built on Oct. 25, 2026, 1:08 a.m.