[R] binding rows from different matrices
p.dalgaard at biostat.ku.dk
Tue Jun 29 17:58:32 CEST 2004
Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
> You can almost always index in such problems: here is one way.
> rbind(veca,vecb,vecc)[matrix(1:15, 3, byrow=T), ]
> Take it apart of see how it works, if it is not immediately obvious.
Or, a little longer, but perhaps more intuitive:
I.e., convert to array, do generalized transpose, convert back to
matrix. Not that I got the index calculations right on first try....
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help