head.rdeque {rstackdeque} | R Documentation |
Returns the first n elements of a deque as a deque, or all of the elements if its length is less than n.
## S3 method for class 'rdeque'
head(x, n = 6L, ...)
x |
rdeque to get the head of. |
n |
number of elements to get. |
... |
arguments to be passed to or from other methods (ignored). |
Runs in O(n)
time (in the size of the number of elements requested).
a new rdeque.
d <- rdeque()
d <- insert_back(d, "a")
d <- insert_back(d, "b")
d <- insert_back(d, "c")
dt <- head(d, n = 2)
print(dt)