I have over 5000 data sets that i want to find p values for using fishers exact test in R. They are saved in a csv file and look something like this;
100 5000 400 500
250 400 600 400
... ... ... ...
where each row represents a contingency table. Right now, I'm having to do a contingency table at a time, which will take me forever.
I used this code so far alltables<-read.table("untitled1.csv") ##to read my data apply(alltables,1, function(x) fisher.test(matrix(x,nr=2))$p.value)
But then I get the error "Error in fisher.test(matrix(x, nr = 2)) : 'x' must have at least 2 rows and columns"