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

Description Usage Arguments Details Value See Also Examples

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

Description

Converts an rstack to a list, where the top of the stack becomes the first element of the list, the second-from-top the second, and so on.

Usage

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

Arguments

x

rstack to convert.

...

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

Details

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

Value

a list containing the elements of the stack in top-to-bottom order.

See Also

as.data.frame.rstack

Examples

1
2
3
4
5
6
s <- rstack()
s <- insert_top(s, "a")
s <- insert_top(s, "b")

slist <- as.list(s)
print(slist)

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