Pad numbers with leading zeros to specified total width
This function pads the specified numbers with zeros to a specified total width.
prependZeros(x, width = max(nchar(x)))
x |
Vector of numbers to be padded. |
width |
Width to pad the numbers to. |
Character vector with the 0-padded numbers.
Peter Langfelder
prependZeros(1:10) prependZeros(1:10, 4)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.