Pad numbers and/or text with leading and/or trailing zeroes.
Usage
pad0(x, n, f = 0)
Arguments
x
vector of numbers and/or strings
n
number of text characters representing a padded integer
f
factor of 10 transformation on x before padding
Value
If length(f)==1 or length(x)==1, the function returns
a character vector representing x with leading zeroes.
If both f and x have lengths >1, then a list of
character vectors indexed by f is returned.
Details
Converts numbers (or text coerced to numeric) to integers and then to text,
and pads them with leading zeroes. If the factor f is >0, then
trailing zeroes are also added.