take {itertools2} | R Documentation |
Return the first n elements of an iterable object as a list
Description
Returns the first n
elements of an iterable object
as a list.
If n
is larger than the number of elements in object
, the
entire iterator is consumed.
Usage
take(object, n = 1)
Arguments
object |
an iterable object |
n |
the number of elements to return in the list |
Value
a list of the first n
items of the iterable object
Examples
take(iterators::iter(1:10), 3) # 1 2 3
take(iterators::iter(1:5), 10) # 1 2 3 4 5
[Package itertools2 version 0.1.1 Index]