View source: R/40-priority_queue-print.R
| print.priority_queue | R Documentation |
Prints a compact summary with priority range and a head/tail preview.
## S3 method for class 'priority_queue'
print(x, max_elements = 4L, show_custom_monoids = FALSE, ...)
x |
A |
max_elements |
Maximum number of elements shown in the preview. |
show_custom_monoids |
Logical; show attached non-default monoids and their root cached measures. |
... |
Passed through to per-element |
Invisibly returns x.
q <- priority_queue(one = 1, two = 2, three = 3, priorities = c(20, 30, 10))
print(q, max_elements = 4)
sum_item <- measure_monoid(`+`, 0, function(entry) as.numeric(entry$value))
q3 <- add_monoids(priority_queue(1, 2, priorities = c(2, 1)), list(sum_item = sum_item))
print(q3, max_elements = 0, show_custom_monoids = TRUE)
q2 <- priority_queue(1, 2, 3, priorities = c(2, 1, 3))
print(q2, max_elements = 3)
print(priority_queue())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.