Skip to content
Prev 105805 / 398506 Next

any way to make the code more efficient ?

Save your intermediate results as a list of matrices.

Then rbind them all at once using do.call.

It looks like this will save 23 seconds (see below), if you are running on 
a PC like mine (AMD 2GHz, WinXP ).

But I wonder, if 23 a mere seconds is all you save is this really worth 
worrying about??

Maybe you are losing time elsewhere.

If so, you need to profile this run and/or track memory usage.
[1] 20.05  1.53 23.24    NA    NA
[1] 0.08 0.00 0.08   NA   NA
[1] TRUE

        
On Fri, 8 Dec 2006, Leeds, Mark (IED) wrote:

            
Charles C. Berry                        (858) 534-2098
                                          Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	         UC San Diego
http://biostat.ucsd.edu/~cberry/         La Jolla, San Diego 92093-0717