Skip to contents

Advances the iterator n-steps ahead without returning anything.

Usage

consume(obj, n = Inf, ...)

# S3 method for iteror
consume(obj, n = Inf, ...)

Arguments

obj

an iterable object

n

The number of elements to consume.

...

passed along to iteror constructor.

Value

obj, invisibly.

See also

take collect

Examples

it <- iteror(1:10)
# Skips the first 5 elements
consume(it, n=5)
# Returns 6
nextOr(it, NA)
#> [1] 6

it2 <- iteror(letters)
# Skips the first 4 elements
consume(it2, 4)
# Returns 'e'
nextOr(it2, NA)
#> [1] "e"