powered by
This function pads the specified numbers with zeros to a specified total width.
prependZeros(x, width = max(nchar(x)))
Character vector with the 0-padded numbers.
Vector of numbers to be padded.
Width to pad the numbers to.
Peter Langfelder
prependZeros(1:10) prependZeros(1:10, 4)
Run the code above in your browser using DataLab