Description Usage Arguments Value Examples
f_pad_zero
- Add leading zeros to numbers.
f_pad_left
- Add leading character to strings.
f_pad_right
- Add trailing character to strings.
1 2 3 4 5 6 7 8 9 10 11 | f_pad_zero(x, width = NULL, pad.char = "0", ...)
f_pad_left(x, pad.char = " ", width = NULL, ...)
f_pad_right(x, pad.char = " ", width = NULL, ...)
ff_pad_zero(...)
ff_pad_left(...)
ff_pad_right(...)
|
x |
A vector of numbers (or string equivalents). |
width |
The width to make the stings. Defaults to the maximum number of
characters for all elements in |
pad.char |
A character to pad the string with. |
... |
ignored. |
Returns a padded string.
1 2 3 4 5 6 7 | f_pad_zero(c(NA, 1, 12))
f_pad_zero(c(NA, 1, 100, 10, 1000))
f_pad_zero(as.character(c(NA, 1, 100, 10, 1000)))
f_pad_zero(c(NA, 1, 100, 10, 1000, "B", "BB"))
f_pad_left(c(NA, 1, 100, 10, 1000, "B", "BB"), '-')
f_pad_right(c(NA, 1, 100, 10, 1000, "B", "BB"), '-')
f_pad_left(c(NA, 1, 12))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.