round_to | R Documentation |
round
, floor
, or ceiling
numerics
to nearest multiple of to
.
round_to(x, to = 1, FUN = round)
ceiling_to(x, to = 1, FUN = ceiling)
floor_to(x, to = 1, FUN = floor)
x |
a numeric vector |
to |
nearest fraction or integer |
FUN |
a function to perform rounding |
roundr
; Round
x <- 1:20 / 10
cbind(
x,
round = round_to(x, 1),
floor = floor_to(x, 1),
ceiling = ceiling_to(x, 1)
)
cbind(
x,
round = round_to(x, 0.5),
floor = floor_to(x, 0.5),
ceiling = ceiling_to(x, 0.5)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.