View source: R/round_to_nearest.R
round_down_to_nearest | R Documentation |
Round prices down to the nearest specified increment
round_down_to_nearest(amount, to_nearest)
amount |
Price to be rounded |
to_nearest |
Increment to which price is to be rounded down to |
# Round down to nearest 0.05 (5c)
library(dplyr)
prices <- c(4.45, 5.22, 0.16, 27.88, 112.19)
prices %>% round_down_to_nearest(0.05)
# Round down to nearest $10
prices <- c(4.45, 5.22, 0.16, 27.88, 112.19)
prices %>% round_down_to_nearest(10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.