boxplot()
In this page:
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()
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")
Login to try C/C++/Java/PHP code in the editor
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: