\name{hclustcompro_cutree}
\alias{hclustcompro_cutree}
\title{
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 \link[stats]{cutree} and \link[stats]{rect.hclust}.
}

\usage{
hclustcompro_cutree(tree, k, main="", sub="", xlab="", ylab="",
    reorder=FALSE, letter=FALSE
)
}

\arguments{
  \item{tree }{a tree as produced by hclust. hclustcompro_cutree() only expects a list with components merge, height, and labels, of appropriate content each.}
  \item{k }{an integer scalar or vector with the desired number of groups}
  \item{main }{an overall title for the plot: see \link[graphics]{title}.}
  \item{sub }{a subtitle for the plot: see \link[graphics]{title}.}
  \item{xlab }{a title for the x axis: see \link[graphics]{title}.}
  \item{ylab }{a title for the y axis: see \link[graphics]{title}.}
  \item{reorder }{logical, reorder the number cluster (from left to right on the dendrogram).}
  \item{letter }{logical, replace number by letter (1->A; 2->B...).}
}

\value{
hclustcompro_cutree returns a vector with group memberships.
}

\author{
A. COULON

L. BELLANGER

P. HUSI
}

\examples{
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)

}
