File: isplit.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 (35 lines) | stat: -rw-r--r-- 772 bytes parent folder | download | duplicates (6)
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
\name{isplit}
\alias{isplit}
\title{Split Iterator}
\description{
  Returns an iterator that divides the data in the vector \code{x}
  into the groups defined by \code{f}.
}
\usage{
isplit(x, f, drop=FALSE, \dots)
}
\arguments{
  \item{x}{vector or data frame of values to be split into groups.}
  \item{f}{a factor or list of factors used to categorize \code{x}.}
  \item{drop}{logical indicating if levels that do not occur should be dropped.}
  \item{\dots}{current ignored.}
}
\value{
  The split iterator.
}
\seealso{
  \code{\link{split}}
}
\examples{
x <- rnorm(200)
f <- factor(sample(1:10, length(x), replace=TRUE))

it <- isplit(x, f)
expected <- split(x, f)

for (i in expected) {
  actual <- nextElem(it)
  stopifnot(actual$value == i)
}
}
\keyword{utilities}