round_nearest: Round up or down a number to the nearest value

View source: R/helpers.R

round_nearestR Documentation

Round up or down a number to the nearest value

Description

Round up or down a number to the nearest value.

Usage

round_nearest(x, nearest = -10)

Arguments

x

A numeric vector.

nearest

A numeric value indicating the nearest value to round by. If negative, will round down to the nearest value. If positive, will round up to the nearest value.

Examples

round_nearest(482.67)
round_nearest(482.67, nearest = -.1)
round_nearest(482.67, nearest = -50)
round_nearest(482.67, nearest = 100)

arnaudgallou/toolkit documentation built on Nov. 25, 2022, 5:42 p.m.