merge2Clusters: Merge Two Clusters

Description Usage Arguments Value Author(s) Examples

View source: R/cutreeWrapper.R

Description

Merge 2 clusters into 1.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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 documentation built on May 2, 2019, 6:12 a.m.