dend_as_hclist: Transform a dendrogram into a list object

View source: R/dend_as_hclist.R

dend_as_hclistR Documentation

Transform a dendrogram into a list object

Description

This function transforms a dendrogram into a hc_list object

Usage

dend_as_hclist(dend)

Arguments

dend

An object of class dendrogram.

Value

A list object of length-num_interior_nodes. The i-th item in the list contains the child nodes of the i-th node in the tree. The negative values in the list indicate leaf nodes, and positive values indicate interior node. The interior nodes are numbered reversely from the root along the branch, i.e., the number corresponding to a node is always smaller than the number corresponding to its parent.

hc_list

The list object that represents the tree structure,

Examples

hc <- hclust(dist(USArrests), "ave")
dend = as.dendrogram(hc)
dah = dend_as_hclist(dend)
## check length of the list
length(dah)
## leaf labels
attr(dah, "leaf_labels")

simone0628/hat documentation built on June 1, 2024, 9 a.m.