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

Description Usage Arguments Details Value See Also Examples

Description

Allows modification access to the front of a queue.

Usage

1
2
## S3 replacement method for class 'rpqueue'
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.

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).

Value

modified rpqueue.

See Also

peek_front.rpqueue for accessing the front data element.

Examples

1
2
3
4
5
6
7
8
9
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)

rstackdeque documentation built on May 19, 2017, 3:07 p.m.

Search within the rstackdeque package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.