Hi, try this A <- c(1:1000) A <- paste ("000",A,sep="") substr (A,nchar(A)-3,nchar(A))
Best regards, Andris Jankevics On Mon, Apr 27, 2009 at 12:35 PM, Mario dos Reis <mdos...@nimr.mrc.ac.uk> wrote: > I've been trough the R documentation for about half an hour and it's not > clear to me how to do this: > > I need to format to character a series of integers from 1 to 1000, and I > like them to look like > > "0001" "0002", "0059", "0123" and so on. Padded with zeroes to have four > digits. > > Cheers! > Mario. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.