Function to round numeric values in a vector to values from an interval sequence.

interval_round(x, interval)

Arguments

x

The numeric vector to adjust

interval

The interval sequence

Value

The vector corrected for the given interval

See also

Examples

interval_round(c(5, 4, 2, 6), interval = seq(1:4))
#> [1] 4 4 2 4