The R Project SVN R

Rev

Rev 77701 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 77701 Rev 77708
Line 9... Line 9...
9
\description{
9
\description{
10
  Returns a matrix of integers indicating the number of their slice in a
10
  Returns a matrix of integers indicating the number of their slice in a
11
  given array.
11
  given array.
12
}
12
}
13
\usage{
13
\usage{
14
slice.index(X, MARGIN)
14
slice.index(x, MARGIN)
15
}
15
}
16
\arguments{
16
\arguments{
17
  \item{X}{an array.  If \code{X} has no dimension attribute, it is
17
  \item{x}{an array.  If \code{x} has no dimension attribute, it is
18
    considered a one-dimensional array.}
18
    considered a one-dimensional array.}
19
  \item{MARGIN}{an integer vector giving the dimension numbers to slice 
19
  \item{MARGIN}{an integer vector giving the dimension numbers to slice 
20
    by.  When \code{X} has named dimnames, it can also be a character
-
 
21
    vector selecting dimension names.}
20
    by.}
22
}
21
}
23
\value{
22
\value{
24
  An integer array \code{y} with dimensions corresponding to those of
23
  An integer array \code{y} with dimensions corresponding to those of
25
  \code{X}.
24
  \code{x}.
26
}
25
}
27
\details{
26
\details{
28
  If \code{MARGIN} gives a single dimension, then all elements of slice
27
  If \code{MARGIN} gives a single dimension, then all elements of slice
29
  number \code{i} with respect to this have value \code{i}.  In general,
28
  number \code{i} with respect to this have value \code{i}.  In general,
30
  slice numbers are obtained by numbering all combinations of indices in
29
  slice numbers are obtained by numbering all combinations of indices in
Line 40... Line 39...
40
}
39
}
41
\seealso{
40
\seealso{
42
  \code{\link{row}} and \code{\link{col}} for determining row and column
41
  \code{\link{row}} and \code{\link{col}} for determining row and column
43
  indexes; in fact, these are special cases of \code{slice.index}
42
  indexes; in fact, these are special cases of \code{slice.index}
44
  corresponding to \code{MARGIN} equal to 1 and 2, respectively when
43
  corresponding to \code{MARGIN} equal to 1 and 2, respectively when
45
  \code{X} is a matrix.
44
  \code{x} is a matrix.
46
}
45
}
47
\examples{
46
\examples{
48
x <- array(1 : 24, c(2, 3, 4))
47
x <- array(1 : 24, c(2, 3, 4))
49
slice.index(x, 2)
48
slice.index(x, 2)
50
slice.index(x, c(1, 3))
49
slice.index(x, c(1, 3))