head.rpqueue: Return the head (front) of an rpqueue

Description Usage Arguments Details Value See Also Examples

View source: R/head.rpqueue.R

Description

Returns the first n elements of an rpqueue as an rpqueue, or all of the elements if length(x) < n.

Usage

1
2
## S3 method for class 'rpqueue'
head(x, n = 6L, ...)

Arguments

x

rpqueue to get the head/top of.

n

number of elements to get.

...

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

Details

Runs in O(n) time (in the size of the number of elements requested).

Value

an rpqueue.

See Also

rpqueue.

Examples

1
2
3
4
5
6
7
q <- rpqueue()
q <- insert_back(q, "a")
q <- insert_back(q, "b")
q <- insert_back(q, "c")

qt <- head(q, n = 2)
print(qt)

rstackdeque documentation built on May 19, 2017, 3:07 p.m.

Search within the rstackdeque package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.