Hello, Emily,
take a look at read.table() for importing (with or without header
depending on your file which holds the data). Maybe
X <- read.table( "yourfilename", header = FALSE, row.names = 1)
and then
pvalues <- apply( X, 1,
function( x)
fisher.test( matrix( x, 2, 2))$p.value
)
does the job (if all the data in your file are such that fisher.test() can
cope with them ...).
Hth -- Gerrit
On Fri, 5 Nov 2010, Emily Wong wrote:
Hi,
I'm new to R and I have a file with many rows of values. Each row
contains a title and values for a contingency table e.g.
row 1= title 8 0 37796 47
which is a table called 'title'
with values
8 0
37796 47
I would like to know how I can import this using R and for each row
calculate a p value using the fisher test. Using each p value I will do
multiple a correction.
I am unsure how to automate this process.
Many thanks,
Emily
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.