R Instructions: Test of Independence Using Technology

Next we will use R to calculate the expected counts. Use the following command to enter the actual counts into R:

data=data.frame(no.risk=c(793,441),moderate.to.severe.risk=c(309,110),row.names=c("participated","did.not.participate"));data

Then use this command to calculate the expected counts:

chisq.test(data)$expected