data <- matrix(scan(),ncol=4,byrow=TRUE) 15 32 18 5 8 29 23 18 1 20 25 22 data ChiSquareExample1 <- data.frame(data) colnames(ChiSquareExample1) <- c("I","II","III","IV") rownames(ChiSquareExample1) <- c("Moderate","MildlySevere","Severe") ChiSquareExample1 rm(data) chisq.test(ChiSquareExample1) # other information is available, such as expected counts chisq.test(ChiSquareExample1)$expected # check the function information for other options # for calculating the p value for the test rm(ChiSquareExample1) # remove object when finished