\HeaderA{as.hclust}{Convert Objects to Class hclust}{as.hclust}
\methaliasA{as.hclust.default}{as.hclust}{as.hclust.default}
\methaliasA{as.hclust.twins}{as.hclust}{as.hclust.twins}
\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{\LinkA{hclust}{hclust}}, \code{\LinkA{diana}{diana}},
\code{\LinkA{agnes}{agnes}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- matrix(rnorm(30), ncol=3)
hc <- hclust(dist(x), method="complete")

if(require(cluster, quietly=TRUE)) {# is a recommended 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}

