Description Usage Arguments Value Author(s) Examples
View source: R/cutreeWrapper.R
Merge 2 clusters into 1.
1 | merge2Clusters(labels, mainClusterLabel, minorClusterLabel)
|
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. |
A vector or factor of the merged labels.
Bin Zhang and Peter Langfelder
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.