Skip to contents

Format value to complete with zeroes to the left until a certain size, e.g., considering a size of 2: 1 -> "01".

Usage

format_digit(x, digits = 2)

Arguments

x

A numeric vector

digits

A numeric integer single value (default = 2), that will be the number of length to add zeroes

Value

A character vector with zeroes added to the left to achieve the desired size.

Examples


x <- c(1,4,10,12)

format_digit(x)
#> [1] "01" "04" "10" "12"