lz: Turn numbers to strings, with leading zeros

Description Usage Arguments Value Author(s) Examples

View source: R/munge.R

Description

Sometimes useful for creating composite primary keys, which order nicely.

Usage

1
lz(x, n = nchar(max(as.numeric(x))))

Arguments

x

A numeric vector (non numeric values will be coerced)

n

The character length of the returned strings. Defaults to the length of the maximum value of x

Value

A character vector of those numbers, with leading zeros

Author(s)

Brendan Rocks [email protected]

Examples

1
lz(c(1, 10, 100))

brendan-r/brocks documentation built on Feb. 17, 2018, 11:34 a.m.