\Header{order.dendrogram}{Get the ordering of the leaves in a dendrogram}
\keyword{manip}{order.dendrogram}
\begin{Description}\relax
This function returns the order (index) for the leaves in a
dendrogram.  These indices can then be used to access the appropriate
components of any additional data.
\end{Description}
\begin{Usage}
\begin{verbatim}
order.dendrogram(x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] A dendrogram (see \code{\Link{as.dendrogram}}).
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The indices for the leaves in left to right order are retrieved.
\end{Details}
\begin{Value}
A vector with length equal to the number of leaves in the dendrogram
is returned.  Each element is the index into the original data (from
which the dendrogram was computed)
\end{Value}
\begin{Author}\relax
R. Gentleman
\end{Author}
\begin{SeeAlso}\relax
\code{\Link{reorder}}, \code{\Link{dendrogram}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  set.seed(123)
  x <- rnorm(10)
  hc <- hclust(dist(x))
  hc$order
  dd <- as.dendrogram(hc)
  order.dendrogram(dd)
\end{ExampleCode}
\end{Examples}

