hist()
In this page:
hist()
hist(x) draws a histogram showing the frequency distribution of a numeric vector, automatically choosing sensible bin widths (or accept an explicit breaks argument). It's one of the fastest ways to visually inspect a dataset's distribution shape. Histograms are a first step in exploratory data analysis for any numeric variable.
Note: Pass breaks = n to hist() to control roughly how many bins the histogram uses.
Example: hist()
set.seed(1)
values <- rnorm(100, mean = 50, sd = 10)
cat("Summary of values that hist() would visualize:\n")
print(summary(values))
cat("hist(values) would draw a histogram of this distribution\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: