pad0 {easyr}R Documentation

Pad with Zeros

Description

Adds leading zeros to a numeric vector to make each value a specific length. For values shorter than length passed, leading zeros are removed. Author: Scott Sobel. Tech Review: Bryce Chamberlain.

Usage

pad0(x, len)

Arguments

x

Vector.

len

Number of characters you want in each value.

Value

Character vector with padded values.

Examples

pad0( c(123,00123,5), len = 5 )
pad0( c(123,00123,5), len = 2 )
pad0( '1234', 5 )

[Package easyr version 0.5-8 Index]