leading_zeros: Add leading zeros to a numeric sequence

View source: R/utils_file.R

leading_zerosR Documentation

Add leading zeros to a numeric sequence

Description

Add n leading zeros to a numeric sequence. This is useful to create a character vector to rename files in a folder.

Usage

leading_zeros(x, n = 3)

Arguments

x

A numeric vector or a list of numeric vectors.

n

The number of leading zeros to add. Defaults to 3.

Value

A character vector or a list of character vectors.

Examples

library(pliman)
leading_zeros(1:5)
leading_zeros(list(a = 1:3,
                   b = 1:5),
              n = 2)

pliman documentation built on Oct. 15, 2023, 1:06 a.m.

Related to leading_zeros in pliman...