lead_char: Add a leading character to equalize string lengths

Description Usage Arguments Value Author(s) See Also Examples

View source: R/lead_char.R

Description

Add a leading character to equalize string lengths

Usage

1
lead_char(x, padChar = "0", padExtra = 0)

Arguments

x

Vector of character, numeric, or factor values to pad. Will be converted immediately to a character vector.

padChar

character to add to the front of values of 'x'. Should be of length 1, or unexpected behavior may result.

padExtra

nonnegative integer of how many extra padChar characters to add to the front of values of 'x'.

Value

character string

Author(s)

Bill Forrest forrest@gene.com

See Also

mapply

Examples

1
2
3
lead_char( 1:10 )
lead_char( 1:10, padChar = '_' )
data.frame( animal = lead_char( c('cat','alligator', 'heron'), padChar = '_' ) )

wfforrest/maeve documentation built on Jan. 1, 2021, 12:47 p.m.