Picks the smallest multiple of unit that is greater than or equal to
max(x). This reproduces the dynamic y-axis trick used throughout the
original survey reports, where bar charts are given a tidy ceiling in units
of 25 (percentages) or 5 (NPS counts) so that data labels never collide with
the top of the panel.
Details
The ceiling is (floor(max(x) / unit) + 1) * unit + pad: the next
multiple of unit strictly above max(x), always leaving headroom even
when the max already sits exactly on a multiple (e.g. nice_max(75) is
100, not 75). Use pad for additional headroom on top of that, e.g.
for annotations above the tallest bar. An all-NA logical column (a common
shape for an empty survey field) is tolerated and returns NA. This is the
engine behind scale_y_pct() and the percentage plot wrappers, which is
why their bars never quite touch the top of the panel.
See also
Other scales:
label_pct(),
scale_y_pct()
