as.rdeque: Create a pre-filled rdeque from a given input

View source: R/as.rdeque.R

as.rdequeR Documentation

Create a pre-filled rdeque from a given input

Description

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

Usage

as.rdeque(x, ...)

Arguments

x

input to convert to an rdeque.

...

additional arguments to be passed to or from methods (ignored).

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.rdeque results in a deque of columns, rather than a deque of rows.

Value

a new rdeque.

See Also

rdeque.

Examples

d <- as.rdeque(1:20)
print(d)

d <- as.rdeque(1:200000)
print(d)

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

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