#install.packages("rcompanion")
library(readxl)
library(ggplot2)
library(rcompanion)
DatasetZ <- read_excel("C:/Users/supri/Downloads/A5Q2.xlsx")
MyTable <- table(DatasetZ$nationality, DatasetZ$scholarship_awarded)

MyTable
##                
##                   0   1
##   Domestic       39 111
##   International 118  32
barplot(MyTable, beside = TRUE,
        
        legend = rownames(MyTable),
        main = "Scholarship by Nationality",
        xlab = "Scholarship Status",
        ylab = "count",
        col = rainbow(nrow(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 nationality and scholarship_awarded.

# The results showed that there [was / was not] an association between the two variables, χ²(1) = 81.297, p <0.001.

# The association was [weak] (Cramer's V = .53).