[R] Optimising code

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Oct 7 11:20:56 CEST 2003


Crispin Miller wrote:

> Hi,
> Does anyone have any advice on speeding up R functions (short of re-implementing them in C :-) )?

Some strategies are in every good book on S/R.


> I have a function that applies a wilcoxon test to 12 sets of about a quarter of a million pairs

... and let me guess: everything is significiant to an almost arbitrary 
value of \alpha?


> (and takes about 3 hours). I've replaced the inner loop I had originally with a function call via mapply, and also considered different approximations  of the wilcoxon, rather than that which is implemented in wilcox.test, but that makes little difference 9and if anything slows things down :-).

Are you using wilcox.test(), or a self written function?

Uwe Ligges


> Cheers,
> Crispin




More information about the R-help mailing list