getclust: Identify Clusters in a Dendrogram

Description Usage Arguments Value Note See Also Examples

View source: R/getclust.R

Description

Reads the position of the graphics pointer when the left mouse button is pressed. It then cuts the tree at the vertical position of the pointer and draws a colored rectangle (rec.col) around the cluster containing the horizontal position of the pointer, and identifies the objects in the corresponding cluster. This can be repeated up to a maximum of N times. Each press of the left mouse button selects a (different) cluster. The new cluster is colored rec.col and the color of the previous one is changed to old.col. When finished, pressing the right mouse button and selecting 'stop' returns control to the command window.

Usage

1
getclust(hc, ngr = 20, rec.col = "blue", old.col = "blue")

Arguments

hc

an object of the type produced by hierclust or hclust

ngr

maximum number of clusters that can be selected

rec.col

color of the most recently selected cluster

old.col

color of the previously selected clusters.

Value

(Invisibly) returns a list where each element contains a vector of object identities contained in the respectively selected clusters.

Note

Make sure you have opened a plot device of your dendrogram already! The vector of object identities for each selected cluster are contained in group[[1]], group[[2]], ..., group[[NrG]] in order of selection, where NrG is the number of selected groups (clicks of the left mouse button). Press Esc or click the right mouse button to end the selection procedure.

See Also

hierclust, hclust, and pam

Examples

1
2
# need to have an object hc produced by hierclust() or hclust()
# groups <- getclust(hc, NrG= 3)

mkampert/rCOSA documentation built on Dec. 23, 2019, 8:21 p.m.