Learn R Programming

iterators (version 1.0.14)

nextElem: Get Next Element of Iterator

Description

nextElem is a generic function used to produce values. If a checkFunc was specified to the constructor, the potential iterated values will be passed to the checkFunc until the checkFunc returns TRUE. When the iterator has no more values, it calls stop with the message 'StopIteration'.

Usage

nextElem(obj, …)

# S3 method for containeriter nextElem(obj, …) # S3 method for funiter nextElem(obj, …)

Arguments

obj

an iterator object.

additional arguments that are ignored.

Value

The value.

Examples

Run this code
# NOT RUN {
  it <- iter(c('a', 'b', 'c'))
  print(nextElem(it))
  print(nextElem(it))
  print(nextElem(it))
# }

Run the code above in your browser using DataLab