[R] Converting integers to chars i.e 1 to "01"
(Ted Harding)
Ted.Harding at nessie.mcc.ac.uk
Wed Jan 5 10:44:08 CET 2005
On 05-Jan-05 Gregor GORJANC wrote:
> Hello!
>
> I am producing a set of images and I would like them to be
> sorted by names I give.
> [...]
> So I would like to convert integers to something like 01 if
> upper limit for this conert is 10 or 001 for 100.
> [...]
Hi Gregor,
'formatC' provides access to C-style formatting. For example:
> formatC(5,format="d",flag="0",width=3)
[1] "005"
> formatC(21,format="d",flag="0",width=3)
[1] "021"
See "?format".
Best wishes,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861 [NB: New number!]
Date: 05-Jan-05 Time: 09:44:08
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list