f_pad_zero {numform} | R Documentation |
Pad Numbers with Leading Zeros
Description
f_pad_zero
- Add leading zeros to numbers.
f_pad_left
- Add leading character to strings.
f_pad_right
- Add trailing character to strings.
Usage
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(...)
Arguments
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. |
Value
Returns a padded string.
Examples
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))
[Package numform version 0.7.0 Index]