My table has 770,000 rows and what I did is:
mydata <- dbGetQuery(mydb, "select * from table")
mydata$pvalue <- apply(as.matrix(mydata[, c(3,5,4,6)]), 1, function(x) fisher.test(matrix(x, nrow=2))$p.value)
to get pvalues.
But it takes so long. (It has been over 24hours and it is still running). Should I use other way to speed up Fisher exact in R?