Box plots and violin plots
📖 Scenario: You are a data analyst working with a dataset of students' test scores from different classes. You want to visualize the distribution of scores to understand how students performed in each class.
🎯 Goal: Build box plots and violin plots in R to compare the score distributions across classes.
📋 What You'll Learn
Create a data frame called
scores with columns class and score using the exact data provided.Create a variable called
classes that stores the unique class names from the data frame.Use a
boxplot() function to create box plots of score grouped by class.Use a
vioplot::vioplot() function to create violin plots of score grouped by class.Print the plots so they are visible in the R plotting window.
💡 Why This Matters
🌍 Real World
Box plots and violin plots are common ways to understand how data is spread out and where most values lie. They help compare groups easily.
💼 Career
Data analysts and scientists use these plots to summarize and communicate data insights clearly to teams and stakeholders.
Progress0 / 4 steps