lz: Turn numbers to strings, with leading zeros

Description Usage Arguments Value Author(s) Examples

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 rocks.brendan@gmail.com

Examples

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

brendan-R/brocks documentation built on May 13, 2019, 5:07 a.m.