"agnes"
represent an agglomerative hierarchical clustering of a dataset.
agnes
object is a list with the following components:agnes
."agnes"
class has methods for the following generic functions:
print
, summary
, plot
, and
as.dendrogram
. In addition, cutree(x, *)
can be used to “cut”
the dendrogram in order to produce cluster assignments.agnes
, diana
,
as.hclust
, hclust
,
plot.agnes
, twins.object
.data(agriculture)
ag.ag <- agnes(agriculture)
class(ag.ag)
pltree(ag.ag) # the dendrogram
## cut the dendrogram -> get cluster assignments:
(ck3 <- cutree(ag.ag, k = 3))
(ch6 <- cutree(as.hclust(ag.ag), h = 6))
stopifnot(identical(unname(ch6), ck3))
Run the code above in your browser using DataLab