Learn R Programming

networkD3 (version 0.1.1)

as.treeNetwork: Convert an R hclust or dendrogram object into a treeNetwork list.

Description

as.treeNetwork converts an R hclust or dendrogram object into a list suitable for use by the treeNetwork function.

Usage

as.treeNetwork(d, root)

Arguments

d
An object of R class hclust or dendrogram.
root
An optional name for the root node. If missing, use the first argument variable name.

Details

as.treeNetwork coverts R objects of class hclust or dendrogram into a list suitable for use with the treeNetwork function.

Examples

Run this code
# Create a hierarchical cluster object and display with treeNetwork
## dontrun
hc <- hclust(dist(USArrests), "ave")
treeNetwork(as.treeNetwork(hc))

Run the code above in your browser using DataLab