# several independent proportions compared to an average # from url: mydataframe <- read.delim("http://www.robin-beaumont.co.uk/virtualclassroom/book2data/chiq1_smokers4groups.dat",header=TRUE) ### local file ignore mydataframe <- read.delim("D:\\web_sites_mine\\HIcourseweb new\\book2data\\chiq1_smokers4groups.dat", header=TRUE) ### names(mydataframe) chisq.test(table(mydataframe), correct=FALSE) # or prop.test(table(mydataframe), correct=FALSE) # prop.test provides additionally a sample proportion estimate for each group. smokers <- c(83, 90, 129, 70) patients <- c(86, 93, 136, 82) prop.test (smokers, patients) # mosaic plot # install the vcd library # install.packages("vcd", dependencies=TRUE) # load the vcd library library(vcd) mosaic(table(mydataframe), shade=TRUE, legend=TRUE)