numform (version 0.5.0)

f_pad_zero: Pad Numbers with Leading Zeros

Description

Add leading zeros to numbers.

Usage

f_pad_zero(x, width = NULL, pad.char = "0", ...)

ff_pad_zero(...)

Arguments

x

A vector of numbers (or string equivalents).

width

The width to make the stings. Defaults to the maximum number of characters for all elements in x.

pad.char

A character to pad the string with.

ignored.

Value

Returns a string of zero padded digits.

Examples

Run this code
# NOT RUN {
f_pad_zero(c(NA, 1, 12))
f_pad_zero(c(NA, 1, 100, 10, 1000))
f_pad_zero(as.character(c(NA, 1, 100, 10, 1000)))
f_pad_zero(c(NA, 1, 100, 10, 1000, "B", "BB"))
# }

Run the code above in your browser using DataLab