Learn R Programming

rstackdeque (version 1.1.1)

peek_front<-.rpqueue: Assign to/modify the front of an rpqueue

Description

Allows modification access to the front of a queue.

Usage

"peek_front"(x, ...) <- value

Arguments

x
rpqueue to modify the front element of.
...
additional arguments to be passed to or from methods (ignored).
value
value to assign to the front data element.

Value

modified rpqueue.

Details

Runs in $O(1)$ worst case time. Throws an error if the rpqueue is empty. Modifies the element in place (i.e., is not side-effect-free).

See Also

peek_front.rpqueue for accessing the front data element.

Examples

Run this code
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)

Run the code above in your browser using DataLab