[R] convert one digit numbers to two digits one
gunter.berton at gene.com
Wed Nov 6 17:33:47 CET 2013
(Assuming I understand) tons of ways of doing this.
So I'll just point out the
function, which you can use to count characters in your tail end and
paste a "0" if there's only one, e.g. via ifelse() .
On Wed, Nov 6, 2013 at 8:25 AM, Alaios <alaios at yahoo.com> wrote:
> Hi all,
> the following returns the hour and the minutes
> paste(DataSet$TimeStamps[selectedInterval$start,4], DataSet$TimeStamps[selectedInterval$start,5],sep=":")
>  "12:3"
> the problem is that from these two I want to create a time stamp so 12:03. The problem is that the number 3 is not converted to 03. Is there an easy way when I have one digit integer to add a zero in the front? Two digits integers are working fine so far, 12:19, or 12:45 would appear correctly
> I would like to thank you in advance for your help
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Genentech Nonclinical Biostatistics
More information about the R-help