Lucy Lucy - 4 months ago 9
R Question

Convert a number to HH:MM:SS

I have a number

154958
. I want to convert to
HH:MM:SS
.

Answer I am looking is
15:49:58
.

Answer

I would treat this as formating output:

formatC(as.integer("154958"), 
        big.mark = ":", big.interval = 2L)
#[1] "15:49:58"
Comments