library(readxl)
library(ggplot2)
mario <- read_excel("D:/Vedant Work/SLU/Spring Sem (Jan to May 2026)/Applied Analytics/Assignment 5/mario.xlsx")

importing the dataset

table(mario$favdrink)
## 
## Coffee   Soda    Tea  Water 
##     26     29     28     17

presenting a table for future refrence

ggplot(mario, aes(x=favdrink,fill=favdrink))+geom_bar()+labs(
  x="studentid",
  y="favdrink",
  title="Distribution of favdrink"
  )+
  theme(
    text=element_text(size=14),
    axis.title=element_text(size=14),
    axis.text=element_text(size=14),
    plot.title=element_text(size=14),
    legend.position="none"
  )

loading a graph for visual clarity

observed<-c(26,29,28,17)
expected<-c(0.25,0.25,0.25,0.25)
chisq.test(x=observed,p=expected)
## 
##  Chi-squared test for given probabilities
## 
## data:  observed
## X-squared = 3.6, df = 3, p-value = 0.308

as indicated by our tables, graphs and chi test protocols, we can establish that observed frequencies are not different from expected frequencies