dendrogram
General Tree Structures

Description

General tree structures.

Usage

as.dendrogram(object, ...)
## S3 method for class 'hclust':
as.dendrogram(object, hang = -1, ...) 
## S3 method for class 'dendrogram':
as.dendrogram(object, ...) 
## S3 method for class 'dendrogram':
cut(x, h, ...) 
## S3 method for class 'dendrogram':
print(x, digits = getOption("digits"), ...) 
## S3 method for class 'dendrogram':
str(object, max.level = NA, digits.d = 3, give.attr = FALSE, 
    wid = getOption("width"), nest.lev = 0, indent.str = "", 
    last.str = "`", stem = "--", ...) 
## S3 method for class 'dendrogram':
[[(x, i, ..., drop = TRUE)
is.leaf(object)

Arguments

object any object that can be converted to class "dendrogram" .
x a "dendrogram" object.
hang This argument is ignored.
h a numeric value. Indicates the height at which the dendrogram is to be cut.
digits a numeric value. Indicates the maximum number of (significant) digits to print.
max.level, digits.d, give.attr, wid, nest.lev, indent.str See the Arguments section in the help file for str.
last.str, stem a character string. Used for the start and the stem of the last branch.
i An integer vector describing the part of the dendrogram to extract. The k'th element of i indicates the desired branch to take at the k'th node in from the root of the dendrogram. x[[c(i,j)]] is equivalent to x[[i]][[j]]. (Most dendrograms involve only two-way splits, so the elements of i are generally 1 or 2.)
drop This argument is ignored.
edge.root a logical value. If TRUE, draws an edge of the root node. The default is FALSE.
nodePar, edgePar a list of plotting parameters to use for plotNodes.

Details

A dendrogram contains the following attributes:
"labels" a character string. Indicates the label of a node.
"members" Indicates the total number of leaves in a branch.
"height" Indicates the height of the dendrogram to be plotted.
"leaf"
"midpoint" Indicates the horizontal distance of the node from the left border in the branch (the units are the number of leaves).
Arbitrary other attributes may attached to the nodes of the dendrogram.
The following generic functions have dendrogram methods: cut, print, str, and [[.
Value
as.dendrogram.hclust returns an object of class "dendrogram" with the attributes "labels", "members", "height", "leaf", and "midpoint". This object will be equivalent to the tree represented by the input hclust object.
as.dendrogram.dendrogram returns the input object, which must be a dendrogram.
cut.dendrogram cuts a dendrogram at height h, returning a list with the components "upper" and "lower".
  • "lower" is a list containing the clipped subtrees.
  • "upper" is the remainder of the original tree after the clipping.
The clipped subtrees are replaced by leaves that specify where, in the "lower" component, the clipping occurs. In addition, the interior nodes in the "upper" tree contains the additional attribute "x.member", specifying how many leaves were beyond this point in the original tree. The "members" atttibute reflects the number of leaves in the clipped tree.
[[.dendrogram returns the designated branch of the input dendrogram.
print.dendrogram returns its input, x.
str.dendrogram returns NULL.
is.leaf if the attribute "leaf" of object x is TRUE, returns TRUE. Otherwise, it returns FALSE.
See Also
str, "[[", cut, print, order.dendrogram.
Examples
hc.fit <- hclust(dist(c(xii=12, i=1, v=5, iv=4, xiv=14)))
dendr.fit <- as.dendrogram(hc.fit)
str(dendr.fit)
str(cut(dendr.fit, h = 4))
str(dendr.fit[[c(1,1)]])
is.leaf(dendr.fit[[c(1,1)]])
Package stats version 6.0.0-69
Package Index