[R] Interlacing two vectors
Jerome Asselin
jerome at hivnet.ubc.ca
Wed Aug 20 23:37:06 CEST 2003
as.vector(rbind(x,z)) or c(rbind(x,y))
saves you one step. Don't know if there's a better solution.
HTH,
Jerome
On August 20, 2003 02:16 pm, Murray Jorgensen wrote:
> I want to interlace two vectors. This I can do:
> > x <- 1:4
> > z <- x+0.5
> > as.vector(t(cbind(x,z)))
>
> [1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5
>
> but this seems rather inelegant. Any suggestions?
>
> Murray
More information about the R-help
mailing list