pad.left: Print a vector with appropriate padding so each has equal...

View source: R/NCmisc.R

pad.leftR Documentation

Print a vector with appropriate padding so each has equal char length.

Description

Print a vector with appropriate padding so each has equal char length.

Usage

pad.left(X, char = " ", numdigits = NA)

Arguments

X

vector of data to pad to equal length

char

character to pad with, space is default, but zero might be a desirable choice for padding numbers

numdigits

if using numeric data, the number of digits to keep

Value

returns the vector in character format with equal nchar()

Author(s)

Nicholas Cooper njcooper@gmx.co.uk

Examples

pad.left(1:10)
phone.numbers <- c("07429719234","7876345123","7123543765")
pad.left(phone.numbers,"0")
pad.left(rnorm(10),numdigits=3)

NCmisc documentation built on Oct. 17, 2022, 5:09 p.m.