LSHTM_analysis/scripts/functions/mychisq_or.R

12 lines
No EOL
259 B
R

mychisq_or = function(dst_numeric, mut_numeric){
tab = as.matrix(table(dst_numeric, mut_numeric))
a = tab[2,2]
if (a==0){ a<-0.5}
b = tab[2,1]
if (b==0){ b<-0.5}
c = tab[1,2]
if (c==0){ c<-0.5}
d = tab[1,1]
if (d==0){ d<-0.5}
(a/b)/(c/d)
}