iterator_batch_cond: Conditioned batch iterator

Description Usage Arguments Value Examples

Description

The conditions are evaluated only once thus cond() should NOT have side effects.

Usage

1
2
3
iterator_batch_cond(x, batch_size = 1L, cond)

iterator_partition_cond(x, part_size = 1L, cond)

Arguments

x

an atomic vector

batch_size

batch size

cond

a conditional function, must be vectorised.

part_size

partition size.

Value

an iterator

Examples

1
2
3
4
5
6
x <- runif(n = 50)
f <- function(a) a < 0.8
itr1 <- iterator_batch(x, 3)
itr2 <- iterator_batch_cond(x, 3, f)
collect(itr1)
collect(itr2)

imlijunda/AwkwardMLTools documentation built on May 13, 2019, 11:33 a.m.