library(ggplot2)
library(gridExtra)

dataset <- read.csv("C:/Users/bmpav/Downloads/StudentsPerformance.csv")
missing_values <- is.na(dataset)

if (any(missing_values)) {
  dataset[missing_values] <- "not completed"
}

if (anyNA(dataset)) {
  print("Still missing values present after handling.")
} else {
  print("No missing values present.")
}
## [1] "No missing values present."
p1 <- ggplot(data = dataset, aes(x = race.ethnicity)) + geom_density(aes(fill = factor(race.ethnicity)), alpha = 0.7) + scale_fill_brewer(palette = "Dark2")+ labs(x="Race Ethnicity", y="density", title="Densityplot_of__Race-ethnicity - 21MIC0065")

p2 <- ggplot(data = dataset, aes(x = gender)) + geom_bar(aes(fill = factor(gender)), alpha = 0.7) + scale_fill_brewer(palette = "Dark2")+ labs(x="Gender", y="Frequency", title="Barplot_of__Gender - 21MIC0065")

p3 <- ggplot(data = dataset, aes(x = parental.level.of.education)) + geom_bar(aes(fill = factor(parental.level.of.education)), alpha = 0.7) + scale_fill_brewer(palette = "Dark2") + labs(x="Parental level of education", y="frequency",title = "Histogram of Parental Level of Education - 21MIC0065")

p4 <- ggplot(data = dataset, aes(x = reading.score, y = writing.score)) + geom_point(aes(color = writing.score)) + scale_color_gradient(low = "blue", high = "red") + labs(x="Reading score" , y="Writing score", title = "Scatter Plot of Reading vs. Writing Scores - 21MIC0065")

p5 <- ggplot(data = dataset, aes(x = gender, y = math.score, fill = gender)) + geom_boxplot(alpha = 0.7) + scale_fill_brewer(palette = "Accent") + labs(y="Math score", x="Gender", title = "Box Plot of Math Scores by Gender-21MIC0065")

p6 <- ggplot(data = dataset, aes(x = test.preparation.course, y = writing.score, color = test.preparation.course)) + geom_line(linetype = "dashed") + scale_color_brewer(palette = "Dark2") + labs(x="Test preparation course", y="writing score", title = "Line Plot of Test Preparation Course vs Writing score-21MIC0065")

p7 <- ggplot(data = dataset, aes(x = factor(race.ethnicity), y = parental.level.of.education)) +geom_tile(aes(fill = factor(gender)), alpha = 0.7) + labs(fill = "#gender") + scale_fill_brewer(palette = "Dark2")+ labs(x="Race ethnicity", y="Parental level of education", title = "Heatmap for race ethnicity s parental level of education over gender -21MIC0065")

p8 <- ggplot(data = dataset, aes(x = gender, y = math.score, fill = gender)) +geom_violin() + scale_fill_manual(values = c("female" = "pink", "male" = "blue"))+labs(x="gender", y="math score", title="Violin plot of gender and math score - 21MIC0065")

p9 <- ggplot(data = dataset, aes(x = math.score, y = reading.score, size = writing.score)) +geom_point(alpha = 0.7) + labs(x="reading score", y="writing score", title="Bubble plot for reading and writing score- 21MIC0065")

p10 <- ggplot(data = dataset, aes(x = factor(math.score), fill = factor(race.ethnicity))) + geom_bar(width = 1, alpha = 0.7) + labs(fill = "#race.ethnicity") +scale_fill_brewer(palette = "Dark2") +coord_polar(start = 0) +labs(y="race ethnicity", x="math score", title="Circular bar plot for math score and race ethnicity - 21MIC0065")

p11 <- ggplot(dataset, aes(x = race.ethnicity, y = math.score)) +geom_segment(aes(xend = race.ethnicity, yend = 0), color = "darkblue") +  geom_point(color = "darkblue", size = 3) +  facet_wrap(~ gender, scales = "free", ncol = 2) + labs(title = "Lollipop Chart of Math Scores by Race/Ethnicity and Gender-21MIC0065", x = "Race Ethnicity", y = "Math Scores")


grid.arrange(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, nrow=4)