powered by
Advances the iterator n-steps ahead without returning anything.
consume(obj, n = Inf, ...)# S3 method for iteror consume(obj, n = Inf, ...)
# S3 method for iteror consume(obj, n = Inf, ...)
obj, invisibly.
obj
an iterable object
The number of elements to consume.
passed along to iteror constructor.
take collect
it <- iteror(1:10) # Skips the first 5 elements consume(it, n=5) # Returns 6 nextOr(it, NA) it2 <- iteror(letters) # Skips the first 4 elements consume(it2, 4) # Returns 'e' nextOr(it2, NA)
Run the code above in your browser using DataLab