Entry=c("Yes","No") Related=c("Weak","Strong") # Save the table as an array (or data frame) SIC.df=expand.grid(Entry=Entry,Related=Related) SIC.df=cbind(SIC.df,count=c(4,102,4,28)) # Convert the data frame to a contingency table SIC.table=xtabs(data=SIC.df,count~Entry+Related) fisher.test(SIC.table) fisher.test(SIC.table,alternative="greater") fisher.test(SIC.table,alternative="less")