[R] construct a vector

From: axionator <axionator_at_gmail.com>
Date: Wed, 26 Nov 2008 14:11:43 +0100


Hi all,
I have an unkown number of vectors (>=2) all of the same length. Out of these, I want to construct a new one as follows:

having vectors u,v and w, the resulting vector z should have entries:
z[1] = u[1], z[2] = v[1], z[3] = w[1]
z[4] = u[2], z[5] = v[2], z[6] = w[2]

...
i.e. go through the vector u,v,w, take at each time the 1st, 2sd, ... elements and store them consecutively in z.
Is there an efficient way in R to do this?

Thanks in advance
Armin



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 26 Nov 2008 - 13:21:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 26 Nov 2008 - 14:00:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive