# Split the vector 1:10 into "chunks" with a maximum length of three
it <- ihasNext(isplitVector(1:10, chunkSize=3))
while (hasNext(it)) {
print(nextElem(it))
}
# Split the vector "letters" into four chunks
it <- ihasNext(isplitVector(letters, chunks=4))
while (hasNext(it)) {
print(nextElem(it))
}
# Get the first five elements of a list as a list
nextElem(isplitVector(as.list(letters), chunkSize=5))
Run the code above in your browser using DataLab