\HeaderA{drop}{Drop Redundant Extent Information}{drop}
\keyword{array}{drop}
\begin{Description}\relax
Delete the dimensions of an array which have only one level.
\end{Description}
\begin{Usage}
\begin{verbatim}
drop(x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an array (including a matrix).
\end{ldescription}
\end{Arguments}
\begin{Value}
If \code{x} is an object with a \code{dim} attribute (e.g., a matrix
or \code{\LinkA{array}{array}}), then \code{drop} returns an object like
\code{x}, but with any extents of length one removed.  Any
accompanying \code{dimnames} attribute is adjusted and returned with
\code{x}: if the result is a vector the \code{names} are taken from
the \code{dimnames} (if any).  If the result is a length-one vector,
the names are taken from the first dimension with a dimname.

Array subsetting (\code{\LinkA{[}{[}}) performs this reduction unless used
with \code{drop = FALSE}, but sometimes it is useful to invoke
\code{drop} directly.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{drop1}{drop1}} which is used for dropping terms in models.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
dim(drop(array(1:12, dim=c(1,3,1,1,2,1,2))))# = 3 2 2
drop(1:3 %*% 2:4)# scalar product
\end{ExampleCode}
\end{Examples}

