What does the bins argument in geom_histogram() do?
bins — sets the number of bars. R figures out the width automatically based on your data range.
binwidth — sets the width of each bar in the actual units of your variable. R figures out how many bars are needed.
So if your data ranges from 0–100:
bins = 10 → 10 bars, each automatically ~10 units wide binwidth = 10 → bars 10 units wide, automatically creates 10 bars Same result here, but they diverge when your data range is irregular. binwidth is generally preferred because it's more interpretable — saying "each bar represents 5 years" means more than "I want 20 bars.