Learn R Programming

SPARTAAS (version 1.2.7)

hclustcompro_cutree: Cut a Tree into Groups of Data.

Description

Cuts the tree and draws rectangles around the branches of the dendrogram highlighting the corresponding clusters. This function is a combination of cutree and rect.hclust.

Usage

hclustcompro_cutree(tree, k, main="", sub="", xlab="", ylab="",
    reorder=FALSE, letter=FALSE
)

Value

hclustcompro_cutree returns a vector with group memberships.

Arguments

tree

a tree as produced by hclust. hclustcompro_cutree() only expects a list with components merge, height, and labels, of appropriate content each.

k

an integer scalar or vector with the desired number of groups

main

an overall title for the plot: see title.

sub

a subtitle for the plot: see title.

xlab

a title for the x axis: see title.

ylab

a title for the y axis: see title.

reorder

logical, reorder the number cluster (from left to right on the dendrogram).

letter

logical, replace number by letter (1->A; 2->B...).

Author

A. COULON

L. BELLANGER

P. HUSI

Examples

Run this code
data(datangkor)

#network stratigraphic data (Network)
network <- datangkor$stratigraphy

#contingency table
cont <- datangkor$contingency

#obtain the dissimilarities matrices
distance <- CAdist(cont, nPC = 11)
constraint <- adjacency(network)

#You can also run hclustcompro with the dist matrix directly (number of cluster 7)
tree <- hclustcompro(d = list(distance, constraint), weight = 0.7,method="ward.D2")
clustering <- hclustcompro_cutree(tree, k = 5)

Run the code above in your browser using DataLab