[R] help with table partition

Jacques VESLOT jacques.veslot at good.ibl.fr
Thu Jun 15 16:15:11 CEST 2006


do.call(cbind, split(as.data.frame(test_table), rep(1:170,each=366)))
-------------------------------------------------------------------
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
-------------------------------------------------------------------


Wong, Kim a écrit :
> Hi,
> 
>  
> 
> I have a test_table where the dim is 62220 by 73 (row by col)
> 
>  
> 
> I would like to partition the rows into 170 equal parts (170 tables
> where each is of dim 366 by 73), and rearrange them horizontally. The
> source codes I have:
> 
>  
> 
> for (i in 1:170) {
> 
>             c = cbind(c,test_table[(367*i+1):(367*(i+1)),2:73]);
> 
>       }
> 
>  
> 
> Unfortunately, using for loop and cbind for a table of this size causes
> long running time.  What is the most efficient way to get the table that
> I want? 
> 
>  
> 
> Thanks for any help.
> 
> K.
> 
> 
> 
> 
> -----------------------------------------
> CONFIDENTIALITY NOTICE: This message and any attachments rel...{{dropped}}
> 
> ______________________________________________
> 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