Add leading zeros to numbers.
f_pad_zero(x, width = NULL, pad.char = "0", ...)ff_pad_zero(...)
ff_pad_zero(...)
A vector of numbers (or string equivalents).
The width to make the stings. Defaults to the maximum number of characters for all elements in x.
x
A character to pad the string with.
ignored.
Returns a string of zero padded digits.
# NOT RUN { 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")) # }
Run the code above in your browser using DataLab