Description Usage Arguments Examples
is.iterator
indicates if an object is an iterator.
end_iteration
throws an exception to signal that there
are no more values available in an iterator.
iteration_has_ended
tests an exception to see if it
indicates that iteration has ended.
new_iterator
returns an iterator object.
1 2 3 4 | is.iterator(x)
end_iteration()
iteration_has_ended(e)
new_iterator(nextElem, ...)
|
x |
any object. |
e |
a condition object. |
nextElem |
a function object that takes no arguments. |
... |
not currently used. |
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Manually iterate using the iteration_has_ended function to help
it <- iter(1:3)
tryCatch({
stopifnot(is.iterator(it))
repeat {
print(nextElem(it))
}
},
error=function(e) {
if (!iteration_has_ended(e)) {
stop(e)
}
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.