peeking | R Documentation |
These methods are side-effect free. Note that unlike R's head()
and
tail()
, the sub-objects are not actually created. They are merely
printed to the terminal.
peek(x, n = 1L) ## S3 method for class 'deque' peek(x, n = 1L) ## S3 method for class 'queue' peek(x, n = 1L) ## S3 method for class 'stack' peek(x, n = 1L) peekback(x, n = 1L) ## S3 method for class 'deque' peekback(x, n = 1L) ## S3 method for class 'queue' peekback(x, n = 1L) ## S3 method for class 'stack' peekback(x, n = 1L)
x |
A queue, stack, or deque. |
n |
The number of items to view. |
View items from the front (peek()
) or back (peekback()
) of a
queue, stack, or deque.
Returns NULL
; sub-elements are only printed.
## Not run: library(dequer) s <- stack() for (i in 1:3) push(s, i) peek(s) peekback(s) peek(s, length(s)) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.