File: iapply.Rd

package info (click to toggle)
r-cran-iterators 1.0.7-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 532 kB
  • sloc: sh: 29; makefile: 1
file content (39 lines) | stat: -rw-r--r-- 799 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
\name{iapply}
\alias{iapply}
\title{Array/Apply Iterator}
\description{
  Returns an iterator over an array, which iterates over the 
  array in much the same manner
  as the \code{apply} function.
}
\usage{
iapply(X, MARGIN)
}
\arguments{
  \item{X}{the array to iterate over.}
  \item{MARGIN}{a vector of subscripts.
    \code{1} indicates the first dimension (rows), \code{2}
    indicates the second dimension (columns), etc.}
}
\value{
  The apply iterator.
}
\seealso{
  \code{\link{apply}}
}
\examples{
a <- array(1:8, c(2, 2, 2))

# iterate over all the matrices
it <- iapply(a, 3)
as.list(it)

# iterate over all the columns of all the matrices
it <- iapply(a, c(2, 3))
as.list(it)

# iterate over all the rows of all the matrices
it <- iapply(a, c(1, 3))
as.list(it)
}
\keyword{utilities}