From: Barry Rowlingson <B.Rowlingson_at_lancaster.ac.uk>

Date: Tue 23 Nov 2004 - 02:19:40 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Nov 23 02:31:28 2004

Date: Tue 23 Nov 2004 - 02:19:40 EST

michael watson (IAH-C) wrote:

> There must be a million ways of doing this!

Here's a Q+D function that fails if you try and insert at the start, or at the end. Its very D.

return(c(v[1:(pos-1)],e,v[(pos):length(v)])) }

> insert(v,5,5)

[1] 1 2 3 4 5 6

Yay.

> insert(v,5,1)

[1] 1 5 1 2 3 4 6

Oops.

Cant be bothered to fix it, the principle is there.

Baz

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Nov 23 02:31:28 2004

*
This archive was generated by hypermail 2.1.8
: Fri 18 Mar 2005 - 01:20:12 EST
*