head.rstack | R Documentation |
Returns the top n elements of an rstack as an stack, or all of the elements
if length(x) < n
.
## S3 method for class 'rstack' head(x, n = 6L, ...)
x |
rstack to get the head/top of. |
n |
number of elements to get. |
... |
arguments to be passed to or from other methods (ignored). |
Runs in O(n) time (in the size of the number of elements requested).
an rstack
.
rstack
.
s <- rstack() s <- insert_top(s, "a") s <- insert_top(s, "b") s <- insert_top(s, "c") st <- head(s, n = 2) print(st) print(s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.