# NOT RUN {
# create an iterator maker for the sample function
mysample <- makeIwrapper('sample')
# use this iterator maker to generate an iterator
# that will generate three five member samples from the
# sequence 1:100
it <- mysample(1:100, 5, count=3)
nextElem(it)
nextElem(it)
nextElem(it)
try(nextElem(it)) # expect a StopIteration exception
# }
Run the code above in your browser using DataLab