View source: R/utils_rounding.R
| round_to | R Documentation |
If accuracy is omitted, number will be rounded to the nearest order of magnitude IE 145, if fn = min, will round to 100
round_to(
...,
accuracy = NULL,
fn = min,
f = if (identical(fn, min)) {
floor
} else {
ceiling
},
na.rm = TRUE
)
... |
|
accuracy |
number to round to; for POSIXct objects, a number of seconds |
fn |
|
f |
rounding function: |
na.rm |
a logical indicating whether missing values should be removed. |
num
Other rounding:
magnitude_order(),
magnitude_triplet(),
num2str(),
num2str_vec(),
num_chr_suffi,
size(),
unit_find(),
unit_modify(),
unit_modify_vec(),
unit_string()
round_to(runif(10, 5, 10), sample(1:10, 5))
round_to(runif(10, 5, 10), sample(1:10, 5), fn = max)
round_to(45)
round_to(145)
round_to(145, fn = max)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.