View source: R/utility_plotting.R
round_limits | R Documentation |
Function to round an array of values to a 'nice' nearby numbers rounded numbers. This can be useful for setting plot limits. Function returns a bounding range
round_limits( vals, lower = NA, upper = NA, log = FALSE, vals_round = c(1, 2, 5, 10) )
vals |
values to be bounded in array |
lower |
user-defined lower limit, which overrides limit found |
upper |
user-defined upper limit, which overrides limit found |
log |
if 'log == FALSE', a linear scale is assumed. If 'log == TRUE', a log10 scale is assumed |
vals_round |
an array with potential rounding values, after values have been scaled by their order of magnitude. Optional values have to be on the domain '1 <= vals_round < 10' |
two-value array with lower and upper limit
x <- c(51, 321) round_limits(x) round_limits(x, lower = 0) round_limits(x, log = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.