View source: R/30-api-flexseq-ends.R
| push_front | R Documentation |
Returns a new sequence with value prepended at the left end.
push_front(x, value)
x |
A |
value |
Element to prepend. |
This operation is persistent: x is not modified.
Elements can be named, but only if all are uniquely named (no missing names).
Updated flexseq.
s <- as_flexseq(letters[2:4])
s2 <- push_front(s, "a")
s2
s # unchanged
n <- as_flexseq(list(two = 2, three = 3))
new_el <- 1
names(new_el) <- "one"
push_front(n, new_el)
# Named/unnamed mixes are rejected
try(push_front(n, 0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.