slice {optpart} | R Documentation |
Slice a Hierarchical Clustering Dendrogram with a Mouse
Description
Allows a simple classification of objects by slicing a dendrogram of a hierarchical cluster analysis graphically with a mouse, or by simply giving a number.
Usage
slice(clust, k=NULL)
Arguments
clust |
an object of class ‘hclust’ produced by |
k |
a desired number of clusters. If null, the function waits on a mouse click |
Value
an object of class ‘clustering’, a list with a vector of cluster memberships
Note
This function is a simple wrapper for cutree
that allows users
to click their mouse at the height they desire to slice the dendrogram, and to establish
the result with a class of ‘clustering’ for ease of use in other functions. If you
want to use the mouse, the dendrogram must have been previously plotted in the current
graphic device.
Author(s)
David W. Roberts droberts@montana.edu http://ecology.msu.montana.edu/labdsv/R
See Also
Examples
data(shoshveg)
dis.bc <- dsvdis(shoshveg,'bray/curtis')
demo <- hclust(dis.bc,'ave')
ave.5 <- slice(demo,5)
## Not run: plot(demo)
## Not run: ave.clust <- slice(demo)