[R] Table of P values for Fisher's exact test

Jacques VESLOT jacques.veslot at good.ibl.fr
Tue Jul 11 11:41:37 CEST 2006


apply(yourdata[, c("X2N_CHB","X2N_AA","Counts_CHB","Counts_AA")], 1, function(x) 
fisher.test(cbind(x[3:4], x[1:2]-x[3:4]))$p.value)
-------------------------------------------------------------------
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
-------------------------------------------------------------------


jenny tan a écrit :
> Hi,
> 
> I have a table of observed counts for various genetic markers. Instead of 
> doing Fisher's exact test for each marker one at a time and recording the P 
> value manually, is there a script to go through the whole list and generate 
> the P value column automatically?
> 
> An example of my data:
> 
> 
> Counts_CHB and Counts_AA are the observed counts for one allele.
> 2N_CHB and 2N_AA are the total number of alleles.
> 
> gene	Local_Pos	2N_CHB	2N_AA	Counts_CHB	Counts_AA     Exact_P
> B2M	2475	90	46	0	5
> B2M	3532	90	44	0	1
> FCN2	2203	88	46	0	1
> FCN2	3536	90	46	0	9
> FCN2	4027	84	46	0	9
> FCN2	4036	90	46	0	9
> FCN2	4318	90	46	0	9
> FCN2	4392	90	46	0	9
> FCN2	9575	90	46	0	1
> 
> ______________________________________________
> 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