leading_zeros | R Documentation |
Add leading zeros
leading_zeros(x, left_digits = NULL, digits = 0, prefix = "", suffix = "", ...)
x |
a numeric vector |
left_digits |
number of digits before decimal point, automatically computed if not provided |
digits |
number of digits after decimal point |
prefix, suffix |
Symbols to display before and after value |
... |
additional paramaters passed to |
formatC
, sprintf
v <- c(2, 103.24, 1042.147, 12.4566, NA)
leading_zeros(v)
leading_zeros(v, digits = 1)
leading_zeros(v, left_digits = 6, big.mark = " ")
leading_zeros(c(0, 6, 12, 18), prefix = "M")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.