\HeaderA{slice.index}{Slice Indexes in an Array}{slice.index}
\keyword{array}{slice.index}
\begin{Description}\relax
Returns a matrix of integers indicating the number of their slice in a
given array.
\end{Description}
\begin{Usage}
\begin{verbatim}
slice.index(x, MARGIN)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an array.  If \code{x} has no dimension attribute, it is
considered a one-dimensional array.
\item[\code{MARGIN}] an integer giving the dimension number to slice by.
\end{ldescription}
\end{Arguments}
\begin{Value}
An integer array \code{y} with dimensions corresponding to those of
\code{x} such that all elements of slice number \code{i} with respect
to dimension \code{MARGIN} have value \code{i}.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{row}{row}} and \code{\LinkA{col}{col}} for determining row and column
indexes; in fact, these are special cases of \code{slice.index}
corresponding to \code{MARGIN} equal to 1 and 2, respectively when \code{x}
is a matrix.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- array(1 : 24, c(2, 3, 4))
slice.index(x, 2)
\end{ExampleCode}
\end{Examples}

