Fisher 精确测试在 R 中需要很长时间,如何提高速度?

Fisher exact test takes long in R, how the improve speed?

我的 table 有 770,000 行并且 我所做的是:

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)

获取 p 值。

但是需要这么长时间。 (已经超过24小时了,还是运行)。 我应该使用其他方法来加速 R 中的 Fisher exact 吗?

Fisher exact test 就像 chi-squared test

来自维基百科:

With large samples, a chi-squared test can be used in this situation. However, the significance value it provides is only an approximation, because the sampling distribution of the test statistic that is calculated is only approximately equal to the theoretical chi-squared distribution.