Description Usage Arguments Value See Also Examples
Round and format numeric vectors; standardising trailing zeros
1 | pretty_round(num, digits = 2, to_pass = c("", " ", "Inf", NaN, NA), ...)
|
num |
A numeric or character vector coercible to a numeric vector. Empty character vectors will be returned by the function. |
digits |
Integer indicating the number of decimal places to be used. |
to_pass |
A character vector specifying what to pass without reformating, by default this includes; NA, NaN, "Inf", "", and " ". |
... |
Pass additional arguements to |
A rounded numeric vector formatted as a character vector with trialing zeros.
format
, and round
for additional information
1 2 3 4 5 6 7 8 9 10 11 | ## Rounding a single number
pretty_round(2.1, digits = 1)
## Rounding with trailing whitespace
pretty_round(2.1, digits = 2)
##Rounding a vector
pretty_round(c(2.13, 2.1, 4.165, 8.2323242, 1), digits = 2)
## Passed without rounding
pretty_round(c("", " ", "Inf", NaN, NA), digits = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.