insert | R Documentation |
Insert elements into a vector.
insert(x, values, before.index)
x |
a vector |
values |
elements to insert |
before.index |
numeric: before which positions of the original vector to insert the new elements |
Inserts elements into a vector.
A vector with values
inserted. If either
values
or before.index
are of length
zero, the original vector is returned.
Enrico Schumann
append
x <- letters[1:5]
## [1] "a" "b" "c" "d" "e"
insert(x, values = "Z", c(2, 5))
## [1] "a" "Z" "b" "c" "d" "Z" "e"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.