as.hclust
Converts Objects to Class hclust
Description
Converts a hierarchical clustering object to class "hclust".
Usage
as.hclust(x, ...)
## Default S3 method:
as.hclust(x, ...)
## S3 method for class 'dendrogram':
as.hclust(x, ...)
## S3 method for class 'twins':
as.hclust(x, ...)
Arguments
x |
a hierarchical clustering object, or an object inherited from class "hclust".
|
... |
additional arguments to be passed to or from future functions.
|
Details
The default method is used to verify whether the object
inherits from class "hclust".
In the method as.hclust.twins, hclust components are extracted
from a "twins" object.
Objects of class "twins" can be created by the
diana and agnes functions in cluster package.
Value
as.hclust.default |
if the input object x inherits from class "hclust",
returns x, else an error is threw.
|
as.hclust.twins, as.hclust.dendrogram |
returns a list of class "hclust", with components as follows:
"merge", "height", "order", "labels", "call", "method", "dist.method".
See the hclust help file for more details.
|
See Also
Examples
x <- c(p1=2, p2=3, p3=5, p4=7, p5=11, p6=13, p7=17, p8=19)
hc <- hclust(dist(x))
str(as.dendrogram(hc))
require(cluster, quietly=TRUE)
dc <- diana(matrix(1:9,3)) # a twins object
as.hclust(dc)
str(as.dendrogram(as.hclust(dc)))