Re: [R] How to insert one element into a vector?

2004-11-23 Thread Jari Oksanen
On Mon, 2004-11-22 at 17:43, Barry Rowlingson wrote: Deepayan Sarkar wrote: Pretty much what 'append' does. A shame then, that help.search(insert) doesn't find 'append'! I cant think why anyone looking for a way of _inserting_ a value in the middle of a vector would think of looking

[R] How to insert one element into a vector?

2004-11-22 Thread jing tang
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

RE: [R] How to insert one element into a vector?

2004-11-22 Thread michael watson (IAH-C)
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

Re: [R] How to insert one element into a vector?

2004-11-22 Thread Barry Rowlingson
michael watson (IAH-C) wrote: There must be a million ways of doing this! Actually I'd say there were no ways of doing this, since I dont think you can actually insert into a vector - you have to create a new vector that produces the illusion of insertion! Here's a Q+D function that fails if

Re: [R] How to insert one element into a vector?

2004-11-22 Thread Roger D. Peng
?append --- look at the `after' argument. -roger jing tang wrote: 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

Re: [R] How to insert one element into a vector?

2004-11-22 Thread Deepayan Sarkar
On Monday 22 November 2004 09:19, Barry Rowlingson wrote: michael watson (IAH-C) wrote: There must be a million ways of doing this! Actually I'd say there were no ways of doing this, since I dont think you can actually insert into a vector - you have to create a new vector that produces

Re: [R] How to insert one element into a vector?

2004-11-22 Thread Peter Dalgaard
Barry Rowlingson [EMAIL PROTECTED] writes: michael watson (IAH-C) wrote: There must be a million ways of doing this! Actually I'd say there were no ways of doing this, since I dont think you can actually insert into a vector - you have to create a new vector that produces the illusion

Re: [R] How to insert one element into a vector?

2004-11-22 Thread Barry Rowlingson
Deepayan Sarkar wrote: Pretty much what 'append' does. A shame then, that help.search(insert) doesn't find 'append'! I cant think why anyone looking for a way of _inserting_ a value in the middle of a vector would think of looking at append! Python has separate insert and append methods for

Re: [R] How to insert one element into a vector?

2004-11-22 Thread Thomas Lumley
On Mon, 22 Nov 2004, Barry Rowlingson wrote: Deepayan Sarkar wrote: Pretty much what 'append' does. A shame then, that help.search(insert) doesn't find 'append'! I cant think why anyone looking for a way of _inserting_ a value in the middle of a vector would think of looking at append! Yes, this