slice: Cut a tree-like object into groups numbered in tree order

Description Usage Arguments Value Author(s) See Also Examples

Description

In comparison with cutree, the groups are numbered from left to right as per the tree when plotted in its standard horizontal form. Note also that the return value will have the leaves sorted in dendrogram order.

Usage

1
slice(x, k = NULL, h = NULL, ...)

Arguments

x

tree like object

k

an integer scalar with the desired number of groups

h

numeric scalar with height where the tree should be cut

...

Additional parameters passed to methods

Value

a named vector with group memberships

Author(s)

jefferis

See Also

cutree,cut.dendrogram,rect.hclust

Examples

1
2
3
4
5
hc <- hclust(dist(USArrests), "ave")
# return groups, leaves ordered by dendrogram
slice(hc,k=5)
# return groups, leaves ordered as originally passed to hclust
slice(hc,k=5)[order(hc$order)]


Search within the dendroextras package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.