View source: R/length.rstack.R
length.rstack | R Documentation |
Returns the number of elements in an rstack.
## S3 method for class 'rstack' length(x)
x |
rstack to get the length of. |
Runs in O(1) time, as this information is stored seperately and updated on every insert/remove.
a vector of length 1, which the number of elements of the stack.
empty
for checking whether an rstack is empty.
s <- rstack() s <- insert_top(s, "a") print(length(s)) # 1 s <- insert_top(s, "b") print(length(s)) # 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.