powered by
Print a vector with appropriate padding so each has equal char length.
pad.left(X, char = " ", numdigits = NA)
returns the vector in character format with equal nchar()
vector of data to pad to equal length
character to pad with, space is default, but zero might be a desirable choice for padding numbers
if using numeric data, the number of digits to keep
Nicholas Cooper njcooper@gmx.co.uk
pad.left(1:10) phone.numbers <- c("07429719234","7876345123","7123543765") pad.left(phone.numbers,"0") pad.left(rnorm(10),numdigits=3)
Run the code above in your browser using DataLab