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 June 29, 2024, 9:15 p.m.