Try this:

formatC(12, width = 5, flag = "0")
or
sprintf("%05d", 12)

On Tue, Oct 21, 2008 at 3:24 PM, culpritNr1 <[EMAIL PROTECTED]> wrote:

>
> Hello List,
>
> Can anybody point me to a number-to-string formatting function?
>
> I need to convert, say, 12 to 00012.
>
> I tried format() but its too stubborn: it seems to only pad with spaces.
>
> Thank you,
>
> Your culpritNr1
>
>
> --
> View this message in context:
> http://www.nabble.com/Paddding-an-integer-with-zeros-tp20095300p20095300.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to