# Test for independence of two categorical variables. # Data: General Social Survey 1982 # Gun registration (favor, opposed) & # Death penalty (favor, opposed) X1=c(784,236) X2=c(311,66) # Stack X1 and X2 as rows in a matrix. M=rbind(X1,X2) chisq.test(M)