Skip to contents

Add zeros before start of the number

Usage

pad_number(x)

Arguments

x

A vector

Value

A character vector that is padded to the length of the maximum entry.

Author

James Balamuta

Examples

# Padding applied
pad_number(8:10)
#> [1] "08" "09" "10"

# No padding applied
pad_number(2:3)
#> [1] "2" "3"

# Pads non-negative number with 0.
# This needs to be improved slightly...
pad_number(-1:1)
#> [1] "-1" "00" "01"