View source: R/50-ordered_sequence-ops.R
| key_at | R Documentation |
Returns the key of the element at a one-based position, without removing it.
This is the positional companion to peek_at() (which returns the value at a
position) and the general form of min_key() (key_at(x, 1)) and
max_key() (key_at(x, length(x))).
key_at(x, index)
x |
An |
index |
One-based position to read. |
Positive integer indices beyond length(x) return NULL. Invalid indices
(NA, non-integer, <= 0, or length not equal to 1) error. Pair with
peek_at() to read the value at the same position, or use pop_at() when
you also want the remaining sequence.
The key at index, or NULL when index is out of bounds.
peek_at(), min_key(), max_key(), nearest_key(), lower_bound(), pop_at()
x <- ordered_sequence("a", "b", "c", keys = c(10, 20, 30))
key_at(x, 2)
key_at(x, 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.