\Header{as.hclust}{Convert Objects to Class hclust}
\methalias{as.hclust.default}{as.hclust}
\methalias{as.hclust.twins}{as.hclust}
\keyword{multivariate}{as.hclust}
\keyword{cluster}{as.hclust}
\begin{Description}\relax
Converts objects from other hierarchical clustering functions to
class \code{"hclust"}.\end{Description}
\begin{Usage}
\begin{verbatim}
as.hclust(x, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] Hierarchical clustering object
\item[\code{...}] further arguments passed to or from other methods.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Currently there is only support for converting objects of
class \code{"twins"} as produced by the functions \code{diana} and
\code{agnes} from the package \pkg{cluster}.  The default method
throws an error unless passed an \code{"hclust"} object.\end{Details}
\begin{Value}
An object of class \code{"hclust"}.\end{Value}
\begin{SeeAlso}\relax
\code{\Link{hclust}}, \code{\Link{diana}},
\code{\Link{agnes}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- matrix(rnorm(30), ncol=3)
hc <- hclust(dist(x), method="complete")

if(require(cluster)) {# is a required package
  ag <- agnes(x, method="complete")
  hcag <- as.hclust(ag)
  ## The dendrograms order slightly differently:
  op <- par(mfrow=c(1,2))
  plot(hc) ;  mtext("hclust", side=1)
  plot(hcag); mtext("agnes",  side=1)
}
\end{ExampleCode}
\end{Examples}

