[R] Breaking a matrix into parts

Jacques VESLOT jacques.veslot at good.ibl.fr
Wed May 3 11:21:48 CEST 2006


lapply(split(mat, gl(nrow(mat)/4, 4, nrow(mat)), cov)


-------------------------------------------------------------------
Jacques VESLOT

CNRS UMR 8090
I.B.L (2ème étage)
1 rue du Professeur Calmette
B.P. 245
59019 Lille Cedex

Tel : 33 (0)3.20.87.10.44
Fax : 33 (0)3.20.87.10.31

http://www-good.ibl.fr
-------------------------------------------------------------------


SUMANTA BASAK a écrit :
> Hi, 
> I've a matrix in 20*11 order. There are 11 variables,
> i.e 11 columns and each variable have 20 row data. Now
> i want to calculate covariance between any variable
> with others taking 4 rows at a time, so that there
> will be 5 blocks. How can i do this using any
> R-function? If i want to do it in any 'loop' function?
> 
> Thanks a lot,
> SB.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list