| dendrogram {stats} | R Documentation |
Class "dendrogram" provides general functions for handling
tree-like structures. It is intended as a replacement for similar
functions in hierarchical clustering and classification/regression
trees, such that all of these can use the same engine for plotting or
cutting trees.
as.dendrogram(object, ...)
## S3 method for class 'hclust'
as.dendrogram(object, hang = -1, ...)
## S3 method for class 'dendrogram'
as.hclust(x, ...)
## S3 method for class 'dendrogram'
plot(x, type = c("rectangle", "triangle"),
center = FALSE,
edge.root = is.leaf(x) || !is.null(attr(x,"edgetext")),
nodePar = NULL, edgePar = list(),
leaflab = c("perpendicular", "textlike", "none"),
dLeaf = NULL, xlab = "", ylab = "", xaxt = "n", yaxt = "s",
horiz = FALSE, frame.plot = FALSE, xlim, ylim, ...)
## S3 method for class 'dendrogram'
cut(x, h, ...)
## S3 method for class 'dendrogram'
merge(x, y, ..., height)
## S3 method for class 'dendrogram'
print(x, digits, ...)
## S3 method for class 'dendrogram'
rev(x)
## 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 = getOption("str.dendrogram.last"), stem = "--",
...)
is.leaf(object)
object |
any R object that can be made into one of class
|
x, y |
object(s) of class |
hang |
numeric scalar indicating how the height of leaves
should be computed from the heights of their parents; see
|
type |
type of plot. |
center |
logical; if |
edge.root |
logical; if true, draw an edge to the root node. |
nodePar |
a |
edgePar |
a |
leaflab |
a string specifying how leaves are labeled. The
default |
dLeaf |
a number specifying the distance in user
coordinates between the tip of a leaf and its label. If |
horiz |
logical indicating if the dendrogram should be drawn horizontally or not. |
frame.plot |
logical indicating if a box around the plot should
be drawn, see |
h |
height at which the tree is cut. |
height |
height at which the two dendrogram should be merged. If not
specified (or |
xlim, ylim |
optional x- and y-limits of the plot, passed to
|
..., xlab, ylab, xaxt, yaxt |
graphical parameters, or arguments for other methods. |
digits |
integer specifying the precision for printing, see
|
max.level, digits.d, give.attr, wid, nest.lev, indent.str |
arguments
to |
last.str, stem |
strings used for |
The dendrogram is directly represented as a nested list where each
component corresponds to a branch of the tree. Hence, the first
branch of tree z is z[[1]], the second branch of the
corresponding subtree is z[[1]][[2]], or shorter
z[[c(1,2)]], etc.. Each node of the tree
carries some information needed for efficient plotting or cutting as
attributes, of which only members, height and
leaf for leaves are compulsory:
memberstotal number of leaves in the branch
heightnumeric non-negative height at which the node is plotted.
midpointnumeric horizontal distance of the node from
the left border (the leftmost leaf) of the branch (unit 1 between
all leaves). This is used for plot(*, center = FALSE).
labelcharacter; the label of the node
x.memberfor cut()$upper,
the number of former members; more generally a substitute
for the members component used for ‘horizontal’
(when horiz = FALSE, else ‘vertical’) alignment.
edgetextcharacter; the label for the edge leading to the node
nodePara named list (of length-1 components)
specifying node-specific attributes for points
plotting, see the nodePar argument above.
edgePara named list (of length-1 components)
specifying attributes for segments plotting of the
edge leading to the node, and drawing of the edgetext if
available, see the edgePar argument above.
leaflogical, if TRUE, the node is a leaf of
the tree.
cut.dendrogram() returns a list with components $upper
and $lower, the first is a truncated version of the original
tree, also of class dendrogram, the latter a list with the
branches obtained from cutting the tree, each a dendrogram.