\Header{aperm}{Array Transposition}
\keyword{array}{aperm}
\begin{Usage}
\begin{verbatim}
aperm(a, perm, resize=TRUE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{a}] the array to be transposed.
\item[\texttt{perm}] the subscript permutation vector.
\item[\texttt{resize}] a flag indicating whether the vector
should be resized as well as having its elements reordered
(default \texttt{TRUE}.)
\end{ldescription}
\end{Arguments}
\begin{Value}
A transposed version of array \texttt{a}, with subscripts permuted as
indicated by the array \texttt{perm}.  If \texttt{resize} is \texttt{TRUE}, the
matrix is reshaped as well as having its elements permuted.

The function \texttt{t} provides a faster and more convenient
way of transposing matrices.\end{Value}
\begin{SeeAlso}
\texttt{\Link{t}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
# interchange the first two subscripts on a 3-way array x
x  <- array(1:24, 2:4)
xt <- aperm(x, c(2,1,3))
all( t(xt[,,2]) == x[,,2] )
\end{ExampleCode}
\end{Examples}

