Description Usage Arguments Details Value See Also Examples
View source: R/peek_front.rpqueue.R
Simply returns the data element sitting at the front of the rpqueue, leaving the queue alone.
1 2 | ## S3 method for class 'rpqueue'
peek_front(x, ...)
|
x |
rpqueue to peek at. |
... |
additional arguments to be passed to or from methods (ignored). |
Runs in O(1)
worst-case time.
data element existing at the front of the queue.
without_front
for removing the front element.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | q <- rpqueue()
q <- insert_back(q, "a")
q <- insert_back(q, "b")
e <- peek_front(q)
print(e)
print(q)
## Assigning to the front data element with peek_front:
q <- rpqueue()
q <- insert_back(q, data.frame(a = 1, b = 1))
q <- insert_back(q, data.frame(a = 1, b = 1))
peek_front(q)$a <- 100
print(q)
peek_front(q) <- data.frame(a = 100, b = 100)
print(q)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.