Function computes a range of numeric values and rounds the lower bound down
(like floor()
and the upper bound up (like ceiling()
) to the specified
number of digits. The function returns a numeric vector of length 2
with the lower and upper bounds of the range.
Arguments
- x
a numeric vector to be bounded
- digits
integer scalar specifying the number of digits to round the bounds to. Positive value determines the number of decimal points to round the bounds to. If
digits
is negative, the bounds are rounded to the nearest 10, 100, etc.- na_rm
a flag indicating whether to remove
NA
values before computing the range. Ifna_rm
isTRUE
, the function computes the range from non-NA
values only. Ifna_rm
isFALSE
, andx
containsNA
values, the function returnsc(NA, NA)
.