roundAny: Round a number to nearest multiple of a given number

View source: R/roundAny.R

roundAnyR Documentation

Round a number to nearest multiple of a given number

Description

Round a number to nearest multiple of a given number

Usage

roundAny(x, y, fun = round)

Arguments

x

Numeric vector

y

Multiple to round to

fun

function for rounding, either round, floor, ceiling

Value

Vector of rounded values

Examples

a <- seq(1, 20, 0.5)
roundAny(a, 2)
roundAny(a, 2, floor)


johngodlee/JLGMisc documentation built on July 17, 2025, 3:09 a.m.