View source: R/30-api-flexseq-ends.R
| pop_at | R Documentation |
Returns the selected element and the remaining sequence.
pop_at(x, index)
x |
A |
index |
One-based position to remove. |
This operation is persistent: x is not modified.
Positive integer indices beyond length(x) return a non-throwing miss object
with value = NULL and remaining = x.
Invalid indices (NA, non-integer, <= 0, or length not equal to 1) error.
A list with fields:
value: the element at index, or NULL when index is out of bounds.
remaining: the sequence after removing the selected element.
x <- flexseq("a", "b", "c", "d")
out <- pop_at(x, 3)
out$value
out$remaining
x # unchanged
pop_at(x, 10)
try(pop_at(x, 0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.