| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/rect.dendrogram.R |
| 3 |
\name{identify.dendrogram} |
| 4 |
\alias{identify.dendrogram} |
| 5 |
\title{Identify Clusters in a Dendrogram (not hclust)} |
| 6 |
\source{ |
| 7 |
This function is based on \link{identify.hclust}, with slight modifications |
| 8 |
to have it work with a dendrogram, as well as adding "horiz" |
| 9 |
} |
| 10 |
\usage{ |
| 11 |
\method{identify}{dendrogram}( |
| 12 |
x, |
| 13 |
FUN = NULL, |
| 14 |
N = 20, |
| 15 |
MAXCLUSTER, |
| 16 |
DEV.FUN = NULL, |
| 17 |
horiz = FALSE, |
| 18 |
stop_if_out = FALSE, |
| 19 |
... |
| 20 |
) |
| 21 |
} |
| 22 |
\arguments{ |
| 23 |
\item{x}{a \link{dendrogram} object.} |
| 24 |
|
| 25 |
\item{FUN}{(optional) function to be applied to the index numbers of the |
| 26 |
data points in a cluster (see 'Details' below).} |
| 27 |
|
| 28 |
\item{N}{the maximum number of clusters to be identified.} |
| 29 |
|
| 30 |
\item{MAXCLUSTER}{the maximum number of clusters that can be produced by |
| 31 |
a cut (limits the effective vertical range of the pointer).} |
| 32 |
|
| 33 |
\item{DEV.FUN}{(optional) integer scalar. If specified, the corresponding |
| 34 |
graphics device is made active before FUN is applied.} |
| 35 |
|
| 36 |
\item{horiz}{logical (FALSE), indicating if the rectangles |
| 37 |
should be drawn horizontally or not (for when using |
| 38 |
plot(dend, horiz = TRUE) ) .} |
| 39 |
|
| 40 |
\item{stop_if_out}{logical (default is FALSE). This default makes the function |
| 41 |
NOT stop if k of the locator is outside the range (this default is different than the behavior |
| 42 |
of the identify.hclust function - but it is nicer for the user.).} |
| 43 |
|
| 44 |
\item{...}{further arguments to FUN.} |
| 45 |
} |
| 46 |
\value{ |
| 47 |
(Invisibly) returns a list where each element contains a vector |
| 48 |
of data points contained in the respective cluster. |
| 49 |
} |
| 50 |
\description{ |
| 51 |
Just like \link{identify.hclust}: |
| 52 |
reads the position of the graphics pointer when the (first) |
| 53 |
mouse button is pressed. It then cuts the tree at the vertical |
| 54 |
position of the pointer and highlights the cluster containing |
| 55 |
the horizontal position of the pointer. Optionally a function is applied |
| 56 |
to the index of data points contained in the cluster. |
| 57 |
} |
| 58 |
\details{ |
| 59 |
By default clusters can be identified using the mouse and an invisible |
| 60 |
list of indices of the respective data points is returned. |
| 61 |
If FUN is not NULL, then the index vector of data points is passed to this |
| 62 |
function as first argument, see the examples below. The active |
| 63 |
graphics device for FUN can be specified using DEV.FUN. |
| 64 |
The identification process is terminated by pressing any mouse button other |
| 65 |
than the first, see also identify. |
| 66 |
} |
| 67 |
\examples{ |
| 68 |
|
| 69 |
\dontrun{ |
| 70 |
set.seed(23235) |
| 71 |
ss <- sample(1:150, 10) |
| 72 |
hc <- iris[ss, -5] \%>\% |
| 73 |
dist() \%>\% |
| 74 |
hclust() |
| 75 |
dend <- hc \%>\% as.dendrogram() |
| 76 |
|
| 77 |
plot(dend) |
| 78 |
identify(dend) |
| 79 |
|
| 80 |
plot(dend, horiz = TRUE) |
| 81 |
identify(dend, horiz = TRUE) |
| 82 |
} |
| 83 |
} |
| 84 |
\seealso{ |
| 85 |
\link{identify.hclust}, |
| 86 |
\link{rect.hclust}, \link{order.dendrogram}, \link{cutree.dendrogram} |
| 87 |
} |