r box plots

# Step 1: Create a data frame or use an existing one
data <- data.frame(
  Group = rep(c("A", "B", "C"), each = 50),
  Value = c(rnorm(50, mean = 0, sd = 1),
            rnorm(50, mean = 2, sd = 1),
            rnorm(50, mean = 4, sd = 1))
)

# Step 2: Create a boxplot using the 'boxplot' function
boxplot(Value ~ Group, data = data, 
        main = "Box Plot Example",
        xlab = "Group",
        ylab = "Value",
        col = c("lightblue", "lightgreen", "lightpink"),
        border = "black")

# Step 3: Add grid lines for better readability
grid()

# Step 4: Add a legend to distinguish between groups
legend("topright", legend = levels(data$Group), 
       fill = c("lightblue", "lightgreen", "lightpink"))

# Step 5: Customize the appearance if needed (optional)