library(dplyr)
# Calculate conditional probabilities of infection after vaccine/placebo
malaria %>%
count(treatment, outcome) %>%
group_by(treatment) %>%
mutate(prop = n / sum(n))
# Fisher's exact text
fisher.test(table(malaria))
Run the code above in your browser using DataLab