library(readxl)
## Warning: package 'readxl' was built under R version 4.5.3
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.5.3
library(rcompanion)
## Warning: package 'rcompanion' was built under R version 4.5.3
A5Q2 <- read_excel("C:/Users/jrutebuka/Desktop/A5Q2.xlsx")
MyTable <- table(A5Q2$scholarship_awarded, A5Q2$nationality)
MyTable
##
## Domestic International
## 0 39 118
## 1 111 32
barplot(MyTable, beside = TRUE,
col = rainbow(nrow(MyTable)),
legend = rownames(MyTable))

chisq.test(MyTable)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: MyTable
## X-squared = 81.297, df = 1, p-value < 2.2e-16
rcompanion::cramerV(MyTable)
## Cramer V
## 0.5272
# A Chi-Square Test of Independence was conducted to determine if there was an association between Variable 1 and Variable 2.
# The results showed that there was an association between the two variables, χ²(1) = 81.29, p <0.001.
# The association was strong, (Cramer's V = 0.53).