round_nearest: Round numbers to the nearest base

Description Usage Arguments Details Value Functions Examples

View source: R/number_functions.R

Description

Functions to round a number to to the nearest base using either nearest value, ceiling or floor methods

Usage

1
2
3
4
5

Arguments

x

A number/vector to round, can be integer or float

base

A base to round to, can be integer or float

Details

Round a number to the nearest base, e.g, round a number to the nearest 500 or 45

Value

A numeric value or a vector of round numeric values.

Functions

Examples

1
2
3
4
5
6
7
8
round_nearest(350, 500)
[1] 500
round_nearest(19.4, 10.1)
[1] 20.2
round_up(350, 500)
[1] 500
round_down(350, 500)
[1] 0

andrewjameshaynes/helpeR documentation built on May 28, 2019, 2:44 p.m.