Still another variation on the same theme:

> matrix(t(cbind(veca,vecb,vecc)),nc=5,byrow=T)

Giovanni

> Date: Tue, 29 Jun 2004 17:58:32 +0200
> From: Peter Dalgaard <[EMAIL PROTECTED]>
> Sender: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED], Stephane DRAY <[EMAIL PROTECTED]>
> Precedence: list
> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2
> Lines: 20
> 
> Prof Brian Ripley <[EMAIL PROTECTED]> 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:
> 
>  matrix(aperm(array(c(veca,vecb,vecc),c(5,5,3)),c(3,1,2)),15)
> 
> 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
> ~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 


-- 

 __________________________________________________
[                                                  ]
[ Giovanni Petris                 [EMAIL PROTECTED] ]
[ Department of Mathematical Sciences              ]
[ University of Arkansas - Fayetteville, AR 72701  ]
[ Ph: (479) 575-6324, 575-8630 (fax)               ]
[ http://definetti.uark.edu/~gpetris/              ]
[__________________________________________________]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to