There must be a million ways of doing this!
If you want to keep the order:

v <- c(1,2,3,4,6)
sort(c(v,5))

Mick

-----Original Message-----
From: jing tang [mailto:[EMAIL PROTECTED] 
Sent: 22 November 2004 14:44
To: [EMAIL PROTECTED]
Subject: [R] How to insert one element into a vector?


suppose I want to insert 5 into the vector (1,2,3,4,6) between 4 and 6.
thx!

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to