Dear r-helpers,

I would be very grateful if you could post the message below on the r-help discussion board. Thank you very much!

Best Wishes,
Pawel


Hello R community,

I am generating lots of results using the fisher.test function, testing many 2x2 tables of SNPs for association with a particular phenotype.

A typical output of the fisher.test function would be (for example):

data:  data1
p-value = 0.9837
alternative hypothesis: true odds ratio is greater than 1
95 percent confidence interval:
 0.4162551       Inf
sample estimates:
odds ratio
 0.6262607

That's lovely, but my problem is that I am only interested in the "p-value" result for each SNP that I check. If it is possible, I would like to extract all the p-values I generate (I use a loop to generate all of them), chuck them into a matrix, and then into a text file. Or perhaps directly export them into a text file, without using a matrix -- whatever is easier. However, I am stuck on how to do this...

Maybe one way would be to save the full results (as they are above) into a text file and then get R to read just the specific part of the file (i.e. the p-value part) and then build a matrix...but I do not know what the code would be for the "specific reading" part..?

Would anyone have any ideas??

Thank you so much for your help!!!

Best Wishes,
Pawel

	[[alternative HTML version deleted]]

