asCharacterWithLeading: asCharacterWithLeading

Description Usage Arguments Author(s) Examples

View source: R/misc.R

Description

convert integer to string with fixed width by leading zeros (or spaces)

Usage

1
asCharacterWithLeading(x, template = "00")

Arguments

x

integer vector: number to convert to string

template

scalar string of intended output length with specifying the leading characters.

Author(s)

Thomas Wutzler

Examples

1
2
3
x <- c(1,11,111)
asCharacterWithLeading(x,"000")
try( asCharacterWithLeading(x) )

twMisc documentation built on May 2, 2019, 6:11 p.m.