13.3.43 contingency table
The table provides data on gender and college for the students in one section of the course Introduction to Computer Science. In the table, we have used the abbreviations BUS for Business, ENG for Engineering and Applied Sciences, and LIB
Group the bivariate data into a contingency table.
First we need to get the data from the question. (We can import it from Excel)
<- read.csv("https://raw.githubusercontent.com/sileaderwt/MTH1320-UMSL/main/Image%2BData/13.3.43/13.3.43.csv")
data data
## Gender College
## 1 M ENG
## 2 M LIB
## 3 F BUS
## 4 F ENG
## 5 M BUS
## 6 M ENG
## 7 M LIB
## 8 M ENG
## 9 M BUS
## 10 M BUS
## 11 M ENG
## 12 M BUS
## 13 M ENG
## 14 F LIB
## 15 M LIB
## 16 F ENG
## 17 F LIB
## 18 F BUS
## 19 F ENG
## 20 F BUS
We store data into 2 variables Gender and College
= data$Gender
Gender = data$College College
First we can find total Male and Female
table(Gender)
## Gender
## F M
## 8 12
Then we can find the total of BUS, ENG, and LIB
table(College)
## College
## BUS ENG LIB
## 7 8 5
We can finish a contingency table by running
table(paste(College,Gender))
##
## BUS F BUS M ENG F ENG M LIB F LIB M
## 3 4 3 5 2 3
Total
sum(as.integer(table(Gender)))
## [1] 20

Hope that helps!