stack | R Documentation |
Methods:
push(elem)
Puts an R object on the top of the stack.
This operation might trigger the allocation of memory, if the
currently allocated memory cannot hold the new element. Still, the
amortized time complexity of the stack is constant.
The stack may contain arbitrary R objects.
pop()
Removes and returns the top element of the stack.
It throws an error if the stack is empty.
peek()
Returns the top element of the stack. (Without
removing it.) It throws an error if the stack is empty.
size()
Returns the number of elements in the stack.
is_empty()
Returns wheather the stack is empty.
S <- stack$new()
S$push(1L)
S$peek()
S$pop()
S$size()
S$push(NULL)
S$push(iris)
colnames(S$peek())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.