[R] produce hours greater than 23

2006-01-04 Thread [EMAIL PROTECTED]
Hy all, I wish to use the date function to draw againt the lifetime of a motor. This lifetime is given to me in Hours (it can go over 5000 hours) I'm unable to find how to convert this lifetime value to something like %H:%M:%S because when R see 24H it says 1 day, i don't want that, i just

Re: [R] produce hours greater than 23

2006-01-04 Thread Gabor Grothendieck
The chron package has a times class that represents times in days and fractions of a day. See the help desk article in R News 4/1 and the references therein for more info. Using times class the following one-line function, hms, will display produce the hours:mm:ss format: library(chron) hms -

Re: [R] produce hours greater than 23

2006-01-04 Thread Gabor Grothendieck
In thinking about this some more here is an even shorter version of hms. Note that %02.f produces at least 2 digits using leading zeros to fill in if necessary and %5.5s truncates the string to the first 5 characters (since our string is of the form mm:ss:hh and we only need the mm:ss part).