isplit | R Documentation |
Returns an iterator that divides the data in the vector x
into the
groups defined by f
.
isplit(x, f, drop = FALSE, ...)
x |
vector or data frame of values to be split into groups. |
f |
a factor or list of factors used to categorize |
drop |
logical indicating if levels that do not occur should be dropped. |
... |
current ignored. |
Originally from the iterators
package.
The split iterator.
split
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 <- nextOr(it, break)
stopifnot(actual$value == i)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.