Re: [R] Make a loop more efficient

2010-10-06 Thread alaios
Thank you very much both of you. I will check and post back later if needed. Best Regards Alex -- View this message in context: http://r.789695.n4.nabble.com/Make-a-loop-more-efficient-tp2955912p2964346.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Make a loop more efficient

2010-10-05 Thread Filoche
Hi there. One more thing you could try is to avoid evaluation of length(CRX) every loop. Assign the length to a variable before the loop. Regards, Phil -- View this message in context: http://r.789695.n4.nabble.com/Make-a-loop-more-efficient-tp2955912p2956274.html Sent from the R help mailing

Re: [R] Make a loop more efficient

2010-10-05 Thread David Winsemius
On Oct 5, 2010, at 8:41 AM, Alaios wrote: Hello everyone I need some advice if the following might be easier implemented. There are n matrixes each matrix needs to calculate one value for the rest n-1 matrixes (but not for itself). I implemented this one by two nested loops for (i in c(1

[R] Make a loop more efficient

2010-10-05 Thread Alaios
Hello everyone I need some advice if the following might be easier implemented. There are n matrixes each matrix needs to calculate one value for the rest n-1 matrixes (but not for itself). I implemented this one by two nested loops for (i in c(1:length(CRX))) { for (j in c(1:length(CRX