Rounds a value to nearest increment

rounder(x, inc, fun = "round")

Arguments

x

The value to be rounded

inc

The increment to round to

fun

The rounding function. Valid options are 'floor', 'round' and 'ceiling'.

Value

an object of class numeric

Examples

rounder(.92, .05)
#> [1] 0.9
rounder(.93, .05)
#> [1] 0.95
rounder(.93, .05, "floor")
#> [1] 0.9
rounder(.93, .05, "ceiling")
#> [1] 0.95