← Back to R Course | Chapter 10: Data Visualization | Lesson 4 of 7

boxplot()

In this page:

  1. boxplot()

boxplot()

boxplot(x) summarizes a numeric vector's distribution visually through its quartiles, median, and outliers, using the same five-number summary as summary(). It's especially useful for comparing distributions across several groups side by side, like boxplot(value ~ group, data = df). Boxplots make outliers immediately visible as points beyond the plot's whiskers.

Note: boxplot(value ~ group, data = df) draws one box per group, making it easy to compare distributions side by side.

Example: boxplot()

markup
set.seed(1)
values <- c(rnorm(20, mean = 50), 150)  # includes an outlier

print(summary(values))
cat("boxplot(values) would show the outlier at 150 clearly beyond the whiskers\n")
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.