View source: R/40-priority_queue-constructors.R
| as_priority_queue | R Documentation |
x and prioritiesConstructs a queue by pairing each element of x with the corresponding
value in priorities.
as_priority_queue(x, priorities)
x |
Elements to enqueue. |
priorities |
Priorities with the same length as |
x is interpreted element-wise (via list coercion). Names on x are
preserved as queue element names.
All priorities must be non-missing and mutually comparable.
A priority_queue.
x <- as_priority_queue(letters[1:4], priorities = c(3, 1, 2, 1))
x
peek_min(x)
peek_max(x)
# Names are preserved
n <- as_priority_queue(setNames(as.list(1:3), c("a", "b", "c")), priorities = c(2, 1, 3))
n[["b"]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.