Q14 - Original Data
Q14 - Original Data
library(ggplot2)
library(dplyr)
# Data
data <- data.frame(
ID = c(1, 2, 3, 4, 5),
Rating = factor(c("Good", "Excellent", "Fair", "Poor", "Good"), levels =
c("Poor", "Fair", "Good", "Excellent"), ordered = TRUE)
)
# 5. Plot a bar chart showing the frequency of each Rating category (similar to 1
but repeated for clarity)
ggplot(data, aes(x = Rating)) +
geom_bar(fill = "lightgreen", color = "black") +
ggtitle("Frequency of Rating Categories") +
xlab("Rating") +
ylab("Count") +
theme_minimal()