library(readxl)
library(rcompanion)
library(ggplot2)
A4Q2 <- read_excel("C:/Users/giuli/OneDrive - Saint Louis University/A4Q2.xlsx")
table(A4Q2$status, A4Q2$scholarship)
##
## 0 1
## Domestic 39 111
## International 118 32
Table2 <- table(A4Q2$status, A4Q2$scholarship)
Table2
##
## 0 1
## Domestic 39 111
## International 118 32
barplot(Table2,
beside = TRUE,
col = rainbow(nrow(Table2)),
legend = rownames(Table2))

chi_result <- chisq.test(Table2)
chi_result
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: Table2
## X-squared = 81.297, df = 1, p-value < 2.2e-16
rcompanion::cramerV(Table2)
## 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, χ²(df) = 75.62, p = 2.663e-16
# The association was large, (Cramer's V = 0.53).