Slice a Hierarchical Clustering Dendrogram with a Mouse
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.
slice(clust, k=NULL)
clust |
an object of class ‘hclust’ produced by |
k |
a desired number of clusters. If null, the function waits on a mouse click |
an object of class ‘clustering’, a list with a vector of cluster memberships
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.
David W. Roberts droberts@montana.edu http://ecology.msu.montana.edu/labdsv/R
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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.