\HeaderA{t}{Matrix Transpose}{t}
\methaliasA{t.data.frame}{t}{t.data.frame}
\methaliasA{t.default}{t}{t.default}
\keyword{array}{t}
\begin{Description}\relax
Given a matrix or \code{\LinkA{data.frame}{data.frame}} \code{x},
\code{t} returns the transpose of \code{x}.
\end{Description}
\begin{Usage}
\begin{verbatim}
t(x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a matrix or data frame, typically.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
A data frame is first coerced to a matrix: see \code{\LinkA{as.matrix}{as.matrix}}.
When \code{x} is a vector, it is treated as \dQuote{column}, i.e., the
result is a 1-row matrix.
\end{Details}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{aperm}{aperm}} for permuting the dimensions of arrays.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
a <- matrix(1:30, 5,6)
ta <- t(a) ##-- i.e.,  a[i, j] == ta[j, i] for all i,j :
for(j in seq(ncol(a)))
  if(! all(a[, j] == ta[j, ])) stop("wrong transpose")
\end{ExampleCode}
\end{Examples}

