[R] (no subject)

Anna Pluzhnikov apluzhni at bsd.uchicago.edu
Fri Nov 18 18:03:17 CET 2005


Hi,
I need to run a Fisher's exact test on thousands of 2x2 contingency tables, and
repeat this process several thousand times (this is a part of the permutation
test for a genome-wide association study).

How can I run this process most efficiently? Is there any way to optimize R code?
 
I have my data in a 2x2xN array (N ~ 5 K; eventually N will be ~ 500 K), and use
apply inside the loop:
> for (iter in 1:1000) {
    apply(data,3,fisherPval)
  }
  fisherPval <- function(x) {
     fisher.test(x)$p.value
  }
Right now, it takes about 30 sec per iteration on an Intel Xeon 3.06GHz processor.

Thanks in advance. 

-- 
Anna Pluzhnikov, PhD
Section of Genetic Medicine
Department of Medicine
The University of Chicago






-------------------------------------------------
This email is intended only for the use of the individual or entity to which
it is addressed and may contain information that is privileged and
confidential.  If the reader of this email message is not the intended
recipient, you are hereby notified that any dissemination, distribution, or
copying of this communication is prohibited.  If you have received this email
in error, please notify the sender and destroy/delete all copies of the
transmittal.  Thank you.




More information about the R-help mailing list