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

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

as.list.rdequeR Documentation

Convert an rdeque to a list

Description

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

Usage

## S3 method for class 'rdeque'
as.list(x, ...)

Arguments

x

rdeque to convert.

...

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

Details

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

Value

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

See Also

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

Examples

d <- rdeque()
d <- insert_front(d, "a")
d <- insert_front(d, "b")

dlist <- as.list(d)
print(dlist)

oneilsh/rstackdeque documentation built on May 17, 2022, 6:29 p.m.