Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

isplit

Split Iterator


Description

Returns an iterator that divides the data in the vector x into the groups defined by f.

Usage

isplit(x, f, drop=FALSE, ...)

Arguments

x

vector or data frame of values to be split into groups.

f

a factor or list of factors used to categorize x.

drop

logical indicating if levels that do not occur should be dropped.

...

current ignored.

Value

The split iterator.

See Also

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)
}

iterators

Provides Iterator Construct

v1.0.13
Apache License (== 2.0)
Authors
Michelle Wallig [cre], Revolution Analytics [aut, cph], Steve Weston [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.