Skip to content
Prev 59572 / 398502 Next

How to insert one element into a vector?

Barry Rowlingson <B.Rowlingson at lancaster.ac.uk> writes:
This is actually an exercise in a certain introductory book on R, with
the intention of having the student do the obvious c(v[1:4],5,v[5:5])
style computation and maybe think a little about the edge effects. I
only recently saw the somewhat unfortunately named append() function,
which has been in S/R ever since the blue book...:
[1] 1 2 3 4 5 6