padInteger: prefix integers with leading zeros

padIntegerR Documentation

prefix integers with leading zeros

Description

prefix integers with leading zeros

Usage

padInteger(x, padCharacter = "0", useNchar = NULL, ...)

Arguments

x

integer, numeric, or character vector. In reality, only nchar(x) is required to determine padding.

padCharacter

character with nchar(padCharacter)==1, used to pad each digit as a prefix.

useNchar

NULL or integer number of digits used, or if the maximum nchar(x) is higher, that number of digits is used. Note useNchar is mostly useful when all numbers are less than 10, but the desired output is to have a fixed number of digits 2 or higher.

...

additional parameters are ignored.

Details

The purpose of this function is to pad integer numbers so they contain a consistent number of digits, which is helpful when sorting values as character strings.

Value

character vector of length(x).

See Also

Other jam string functions: asSize(), breaksByVector(), cPasteSU(), cPasteS(), cPasteUnique(), cPasteU(), cPaste(), fillBlanks(), formatInt(), gsubOrdered(), gsubs(), makeNames(), mixedOrder(), mixedSortDF(), mixedSorts(), mixedSort(), mmixedOrder(), nameVectorN(), nameVector(), padString(), pasteByRowOrdered(), pasteByRow(), sizeAsNum(), tcount(), ucfirst(), uniques()


jmw86069/jamba documentation built on Oct. 9, 2024, 10:52 a.m.