peek_front.rdeque {rstackdeque} | R Documentation |
Return the data element at the front of an rdeque
Description
Simply returns the data element sitting at the front of the rdeque, leaving the rdeque alone.
Usage
## S3 method for class 'rdeque'
peek_front(x, ...)
Arguments
x |
rdeque to peek at. |
... |
additional arguments to be passed to or from methods (ignored). |
Details
Runs in O(1)
worst-case time.
Value
data element existing at the front of the rdeque.
See Also
without_front
for removing the front element.
Examples
d <- rdeque()
d <- insert_front(d, "a")
d <- insert_front(d, "b")
e <- peek_front(d)
print(e)
print(d)
## Assigning to the front data element with peek_front:
d <- rdeque()
d <- insert_front(d, data.frame(a = 1, b = 1))
d <- insert_front(d, data.frame(a = 1, b = 1))
peek_front(d)$a <- 100
print(d)
peek_front(d) <- data.frame(a = 100, b = 100)
print(d)
[Package rstackdeque version 1.1.1 Index]