axionator wrote: > 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? > >
suppose you have your vectors collected into a list, say vs; then the following will do: as.vector(do.call(rbind, vs)) vQ ______________________________________________ R-help@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.