Create a data frame

student_grades <- data.frame( StudentID = 1:10, Name = c(“Alice”, “Bob”, “Charlie”, “Diana”, “Ethan”, “Fiona”, “George”, “Hannah”, “Ian”, “Jenna”), Age = c(20, 22, 19, 21, 20, 22, 19, 21, 20, 22), Gender = c(“F”, “M”, “M”, “F”, “M”, “F”, “M”, “F”, “M”, “F”), Major = c(“Computer Sci”, “Mathematics”, “Physics”, “Engineering”, “Biology”, “Chemistry”, “Literature”, “Mathematics”, “Physics”, “Computer Sci”), GPA = c(3.8, 3.5, 3.7, 3.9, 3.4, 3.6, 3.2, 3.8, 3.5, 3.7), Math = c(90, 78, 85, 92, 76, 88, 70, 85, 80, 89), English = c(85, 82, 88, 84, 80, 87, 78, 90, 83, 88), History = c(88, 80, 90, 86, 85, 90, 82, 88, 85, 86), Science = c(92, 75, 87, 95, 82, 89, 68, 91, 79, 91) ) # Print the data frame print(student_grades)

summary(student_grades) # Extract the ‘Name’ and ‘GPA’ columns student_grades_subset <- student_grades[, c(“Name”, “GPA”)] print(student_grades_subset)

Extract rows where GPA is greater than 3.5

high_gpa_students <- subset(student_grades, GPA > 3.5) print(high_gpa_students)

plot(student_grades\(Math, student_grades\)GPA, xlab = “Math Scores”, ylab = “GPA”, main = “GPA vs. Math Scores”)

Compare Math scores by Gender

library(ggplot2)

Boxplot of Math scores by Gender

ggplot(student_grades, aes(x = Gender, y = Math)) + geom_boxplot() + labs(title = “Comparison of Math Scores by Gender”, x = “Gender”, y = “Math Scores”)

Calculate mean Math scores by Gender

mean_math_scores <- aggregate(Math ~ Gender, data = student_grades, mean) print(mean_math_scores)

R Markdown