Skip to contents

range_extend returns a vector containing the minimum and maximum of all the given arguments rounded outward to the value provided by nearest.

Usage

range_extend(x, nearest = 1)

Arguments

x

any numeric object.

nearest

numeric; the range of x will be rounded out to the value specified by nearest. Default is 1.

Value

A numeric vector of length 2 specifying the range of values after rounding outward to the value provided by nearest.

See also

Author

Tyler Sagendorf

Examples

set.seed(0)
x <- runif(5, min = -10, max = 10)
range(x) # -4.689827  8.164156
#> [1] -4.689827  8.164156

range_extend(x) # -5  9
#> [1] -5  9
range_extend(x, nearest = 0.1) # -4.7  8.2
#> [1] -4.7  8.2