Learn R Programming

dendextend (version 1.18.1)

get_leaves_attr: Get/set attributes of dendrogram's leaves

Description

Get/set attributes of dendrogram's leaves

Usage

get_leaves_attr(dend, attribute, simplify = TRUE, ...)

Value

A vector (or a list) with the dendrogram's leaves attribute

Arguments

dend

a dendrogram object

attribute

character scalar of the attribute (attr) we wish to get/set from the leaves

simplify

logical. If TRUE (default), then the return vector is after using unlist on it.

...

not used

See Also

get_nodes_attr, nnodes, nleaves, assign_values_to_leaves_nodePar

Examples

Run this code
# define dendrogram object to play with:
hc <- hclust(dist(USArrests[1:3, ]), "ave")
dend <- as.dendrogram(hc)

# get_leaves_attr(dend) # error :)
get_leaves_attr(dend, "label")
labels(dend, "label")
get_leaves_attr(dend, "height") # should be 0's
get_nodes_attr(dend, "height")

get_leaves_attr(dend, "nodePar")


get_leaves_attr(dend, "leaf") # should be TRUE's
get_nodes_attr(dend, "leaf") # conatins NA's


get_leaves_attr(dend, "members") # should be 1's
get_nodes_attr(dend, "members") #


get_leaves_attr(dend, "members", simplify = FALSE) # should be 1's

Run the code above in your browser using DataLab