roundto.multiple: Rounds 'x' to the nearest multiple of 'N'

View source: R/rutils.R

roundto.multipleR Documentation

Rounds x to the nearest multiple of N

Description

Rounds x to the nearest multiple of N

Usage

roundto.multiple(x, N, adjust = "closest")

Arguments

x

numeric or integer

N

numeric or integer

adjust

character: 'closest': Returns the closest multiple of N
'top' ': Returns the closest multiple of N that is greater than x
'bottom' : Returns the closest multiple of N that is smaller than x

Value

A numeric

Examples

roundto.multiple(345.45, 1)
[1] 345
roundto.multiple(345.45, 7)
[1] 343
roundto.multiple(345.45, 7.2)/7.2
[1] 48


genpack/gener documentation built on March 14, 2023, 9:52 a.m.