merge2Clusters {dynamicTreeCut}R Documentation

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)



[Package dynamicTreeCut version 1.63-1 Index]