HclustParam-class: Hierarchical clustering

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Run the base hclust function on a distance matrix within clusterRows.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
HclustParam(
  metric = "euclidean",
  method = "complete",
  cut.fun = NULL,
  cut.dynamic = FALSE,
  cut.height = NULL,
  cut.number = NULL,
  ...
)

## S4 method for signature 'ANY,HclustParam'
clusterRows(x, BLUSPARAM, full = FALSE)

Arguments

metric

String specifying the distance metric to use in dist.

method

String specifying the agglomeration method to use in hclust.

cut.fun

Function specifying the method to use to cut the dendrogram. The first argument of this function should be the output of hclust, and the return value should be an atomic vector specifying the cluster assignment for each observation. Defaults to cutree if cut.dynamic=FALSE and cutreeDynamic otherwise.

cut.dynamic

Logical scalar indicating whether a dynamic tree cut should be performed using the dynamicTreeCut package.

cut.height

Numeric scalar specifying the cut height to use for the tree cut when cut.fun=NULL. If NULL, defaults to half the tree height. Ignored if cut.number is set.

cut.number

Integer scalar specifying the number of clusters to generate from the tree cut when cut.fun=NULL.

...

Further arguments to pass to cut.fun, when cut.dynamic=TRUE or cut.fun is non-NULL.

x

A numeric matrix-like object where rows represent observations and columns represent variables.

BLUSPARAM

A HclustParam object.

full

Logical scalar indicating whether the hierarchical clustering statistics should be returned.

Details

To modify an existing HclustParam object x, users can simply call x[[i]] or x[[i]] <- value where i is any argument used in the constructor.

Value

The HclustParam constructor will return a HclustParam object with the specified parameters.

The clusterRows method will return a factor of length equal to nrow(x) containing the cluster assignments. If full=TRUE, a list is returned with clusters (the factor, as above) and objects (the hclust output).

Author(s)

Aaron Lun

See Also

dist, hclust and cutree, which actually do all the heavy lifting.

cutreeDynamic, for an alternative tree cutting method to use in cut.fun.

Examples

1
2
clusterRows(iris[,1:4], HclustParam())
clusterRows(iris[,1:4], HclustParam(method="ward.D2"))

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