Re: [R] append

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sun 11 Dec 2005 - 03:22:23 EST

append does not take a vector the after= argument. Its probably easiest to just use a loop:

x <- 1:5
for(i in c(4,2)) x <- append(x, 0:1, after = i)

Note that they need to be inserted in reverse order.

On 12/10/05, Judy Chung <cp3942@gmail.com> wrote:
> Dear R users:
>
> > append(1:5, 0:1, after=2)
> [1] 1 2 0 1 3 4 5
>
> If I want to repeat the appended value every 2 like the following:
> [1] 1 2 0 1 3 4 0 1 5
>
> How should I modify?
> Thank you for any help.
>
> ______________________________________________
> 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
>



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 Sun Dec 11 03:32:06 2005

This archive was generated by hypermail 2.1.8 : Sun 11 Dec 2005 - 09:29:13 EST