Insert an element into a vector.

insert(elem, slot, v)

Arguments

elem

element to insert

slot

location of insert

v

vector to insert into

Value

vector with element inserted

Examples

insert(2, 1, 1)
#> [1] 2 1
insert(2, 2, 1)
#> [1] 1 2
insert('x', 5, letters)
#> [1] "a" "b" "c" "d" "x" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" #> [20] "s" "t" "u" "v" "w" "x" "y" "z"