[R] Help with adding minutes to time
Jean-Louis Abitbol
abitbol at sent.com
Tue May 30 19:15:26 CEST 2006
Dear R Helpers,
I need to read time from a .csv file which is formated as chartime
(09:12:00) below. I need to add one minute (cf chartime2).
Then I need to output the value just as 09:13 without the seconds for
writing a csv file and input in another program.
I get it with the following reproducible example but I can't help
thinking that there must a less clumsy way to do that !
Thanks for any input and eventually a pointer to an example of how to
add minutes or seconds to a time without a date which I think makes
POSIX not relevant in this case.
Best regards, Jean-louis
library(chron)
chartime<-"09:12:00"
chartime2<-"00:01:00"
chrontime<-times(chartime)
chrontime2<-times(chartime2)
test<-chrontime+chrontime2
test<-as.character(test)
test<-sub(":00","",test)
More information about the R-help
mailing list