Unable to format 3 digits to hour format in R

I have been unable to convert 3 digits to hour format in R.I have a column called usage hours in a data frame which is of character type and has values like 138:25:36,24:45:12,230:56:31 etc which are in the pattern of hours:minutes:seconds.Can anyone please help me out here.

It's a bit urgent.So any leads sooner will be helpful.

im sorry but its not clear what you would like these turned into ?
138:25:36 should be ?
24:45:12 should be ?
230:56:31 should be ?

Hours: minutes:seconds

so they should stay exaclty as they are ?

Yes exactly.thats how it should be.

sorry, I missed the part where you said they are character and you want some form of numeric representation.
Use lubridate package like

lubridate::hms("138:25:36")

So will it work for values where the hour is in 3 digits.

yes, it will work for values where the hour is in 3 digits.

Ok.so it should then also work for values where the minutes and seconds are also in 3 digits then.

Let me try and wl revert back in case its not working.Thanks for the help.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.