Pad numbers and/or text with leading and/or trailing zeroes.
pad0(x, n, f = 0)
vector of numbers and/or strings
number of text characters representing a padded integer
factor of 10 transformation on
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.
length(x)==1, the function returns
a character vector representing
x with leading zeroes.
x have lengths >1, then a list of
character vectors indexed by
f is returned.
Rowan Haigh, Pacific Biological Station, Fisheries and Oceans Canada, Nanaimo BC
1 2 3 4