R/unbranch.R
get_root_branches_attr.Rd
get attributes from the dendrogram's root(!) branches
get_root_branches_attr(dend, the_attr, warn = dendextend_options("warn"), ...)
dendrogram object
the attribute to get from the branches (for example "height")
logical (default from dendextend_options("warn") is FALSE). Set if warning are to be issued, it is safer to keep this at TRUE, but for keeping the noise down, the default is FALSE. Should a warning be printed when the function is used on an object which is NOT a dendrogram.
passed on to attr
The attributes of the branches (often two) of the dendrogram's root
hc <- hclust(dist(USArrests[2:9, ]), "com")
dend <- as.dendrogram(hc)
get_root_branches_attr(dend, "height") # 0.00000 71.96247
#> [1] 98.08119 99.10832
# plot(dend)
str(dend, 2)
#> --[dendrogram w/ 2 branches and 8 members at h = 226]
#> |--[dendrogram w/ 2 branches and 3 members at h = 98.1]
#> | |--leaf "Connecticut"
#> | `--[dendrogram w/ 2 branches and 2 members at h = 36.7] ..
#> `--[dendrogram w/ 2 branches and 5 members at h = 99.1]
#> |--leaf "Florida"
#> `--[dendrogram w/ 2 branches and 4 members at h = 58.6] ..