This function ensures that fixed width data is the right length by padding zeroes to the front of values. This is a common problem with fixed width data after importing into R as non-character type.
leading_zero(x, digits = 2)
a vector of numeric data that should be fixed width but is missing leading zeroes.
an integer representing the desired width of
If x contains negative values then the width specified by digits
will include one space taken up for the negative sign. The function does not
trim values that are longer than digits, so the vector produced will not
have a uniform width if
nchar(x) > d
A character vector of length
Jason P. Becker
Jared E. Knowles
1 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.