as.list.rpqueue: Convert an rpqueue to a list

Description Usage Arguments Details Value See Also Examples

View source: R/as.list.rpqueue.R

Description

Converts an rpqueue to a list, where the front of the queue becomes the first element of the list, the second-from-front the second, and so on.

Usage

1
2
## S3 method for class 'rpqueue'
as.list(x, ...)

Arguments

x

rpqueue to convert.

...

additional arguments passed to as.list after initial conversion to list.

Details

Runs in O(N) time in the size of the rpqueue, but the generated list is pre-allocated for efficiency.

Value

a list containing the elements of the rpqueue in front-to-back order.

See Also

as.data.frame.rpqueue and the generic as.list.

Examples

1
2
3
4
5
6
q <- rpqueue()
q <- insert_back(q, "a")
q <- insert_back(q, "b")

qlist <- as.list(q)
print(qlist)

rstackdeque documentation built on May 2, 2019, 4:15 a.m.