consume | R Documentation |
Advances the iterator n-steps ahead without returning anything.
consume(obj, n = Inf, ...)
## S3 method for class 'iteror'
consume(obj, n = Inf, ...)
obj |
an iterable object |
n |
The number of elements to consume. |
... |
passed along to iteror constructor. |
obj
, invisibly.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.