source("http://www.uvm.edu/~rsingle/Rdata/scripts_stat295F14.R") fms <- otherdata("FMS_small.tsv", sep="\t") attach(fms) x <- table(esr1_rs1042717,pre.BMI>25) x or.AA.GG <- (x[1,1]*x[3,2])/(x[1,2]*x[3,1]) or.GA.GG <- (x[2,1]*x[3,2])/(x[2,2]*x[3,1]) or.AA.GG or.GA.GG #swap the order of the columns (equivalent to the reciprocal of the above ORs) x <- table(esr1_rs1042717, !(pre.BMI>25) ) x or.AA.GG <- (x[1,1]*x[3,2])/(x[1,2]*x[3,1]) or.GA.GG <- (x[2,1]*x[3,2])/(x[2,2]*x[3,1]) or.AA.GG or.GA.GG chisq.test( table(esr1_rs1042717,pre.BMI>25) ,correct=F )