round_up_to_nearest: Round prices up to the nearest specified increment

View source: R/round_to_nearest.R

round_up_to_nearestR Documentation

Round prices up to the nearest specified increment

Description

Round prices up to the nearest specified increment

Usage

round_up_to_nearest(amount, to_nearest)

Arguments

amount

Price to be rounded

to_nearest

Increment to which price is to be rounded up to

Examples


# Round up to nearest 0.05 (5c)
library(dplyr)
prices <- c(4.45, 5.22, 0.16, 27.88, 112.19)
prices %>% round_up_to_nearest(0.05)


# Round up to nearest $10
prices <- c(4.45, 5.22, 0.16, 27.88, 112.19)
prices %>% round_up_to_nearest(10)

priceR documentation built on Oct. 22, 2023, 1:10 a.m.