I am writing a function to plot data. I would like to specify a nice round number for the y-axis max that is greater than the max of the dataset.
max
Specif
The plyr library has a function round_any that is pretty generic to do all kinds of rounding. For example
plyr
round_any
library(plyr) round_any(132.1, 10) # returns 130 round_any(132.1, 10, f = ceiling) # returns 140 round_any(132.1, 5, f = ceiling) # returns 135