# data from Table 5.5.2 data <- matrix(scan(),ncol=2,byrow=TRUE) 3 8 4 4 data data table552 <- data.frame(data) colnames(table552) <- c("PE","No PE") rownames(table552) <- c("Drug","No Drug") table552 rm(data) # Here is Fisher's exact test fisher.test(table552) # Here is Fisher's exact test specifying a directional alternative fisher.test(table552,alternative="less") rm(table552) # Table probabilities can be calculated directly using the function for the hypergeometric # distribution, dhyper dhyper(0, 7, 12, 11) +dhyper(1, 7, 12, 11) +dhyper(2, 7, 12, 11) +dhyper(3, 7, 12, 11) [1] 0.2966182