Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

merge2Clusters

Merge Two Clusters


Description

Merge 2 clusters into 1.

Usage

merge2Clusters(labels, mainClusterLabel, minorClusterLabel)

Arguments

labels

a vector or factor giving the cluster labels

mainClusterLabel

label of the first merged cluster. The merged cluster will have this label.

minorClusterLabel

label of the second merged cluster.

Value

A vector or factor of the merged labels.

Author(s)

Bin Zhang and Peter Langfelder

Examples

options(stringsAsFactors = FALSE);

# Works with character labels:
labels = c(rep("grey", 5), rep("blue", 2), rep("red", 3))
merge2Clusters(labels, "blue", "red")

# Works with factor labels:
labelsF = factor(labels)
merge2Clusters(labelsF, "blue", "red")

# Works also with numeric labels:

labelsN = as.numeric(factor(labels))
labelsN
merge2Clusters(labelsF, 1, 3)

dynamicTreeCut

Methods for Detection of Clusters in Hierarchical Clustering Dendrograms

v1.63-1
GPL (>= 2)
Authors
Peter Langfelder <Peter.Langfelder@gmail.com> and Bin Zhang <binzhang.ucla@gmail.com>, with contributions from Steve Horvath <SHorvath@mednet.ucla.edu>
Initial release
2016-03-10

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.