as.rstack: Create an rstack pre-filled from a given input

View source: R/as.rstack.R

as.rstackR Documentation

Create an rstack pre-filled from a given input

Description

Creates a new rstack from a given input. Coerces input to a list first using as.list, the element at x[[1]] becomes the top of the new rstack.

Usage

as.rstack(x, ...)

Arguments

x

input to convert to a stack.

...

additional arguments to be passed to or from methods.

Details

Runs in O(N) in the size of the input. Because data frames return a list of columns when run through as.list, running as.rstack results in a stack of columns, rather than a stack of rows.

Value

a new rstack.

See Also

rstack.

Examples

s <- as.rstack(1:20)
print(s)

s <- as.rstack(1:200000)
print(s)

## A stack with only 5 elements, one for each column
oops <- as.rstack(iris)
print(oops)

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