zeropad: Format numbers in constant width with leading zeros

Description Usage Arguments Examples

View source: R/zeropad.R

Description

Formats numbers for alphabetic sorting by padding with zeros to constant string width. If width is not supplied, a default value is calculated based on the values in x.

Usage

1
zeropad(x, digits = 0, width = NULL)

Arguments

x

Vector of numbers.

digits

Number of decimal places (defaults to 0).

width

Width of character values returned.

Examples

1
paste0('ID', zeropad(1:20))

stevetnz/stevesRfunctions documentation built on May 28, 2019, 8:21 a.m.