pad.left {NCmisc} | R 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)
[Package NCmisc version 1.2.0 Index]