[R] Odp: Adding minutes to 24 hour time

Petr PIKAL petr.pikal at precheza.cz
Wed Mar 17 15:27:53 CET 2010


Hi

r-help-bounces at r-project.org napsal dne 17.03.2010 14:57:32:

> Hi,
> 
> Does anyone know how to add minutes (up to 100 min) to a 24 hour time, 
to 
> create a new 24 hour time? I can't seem to find any documentation or 
examples 
> explaining how to do this. The variables of interest are 
'ARRIVE','WAIT', and 
> 'DEPART' in the attached partial dataframe. I want 'DEPART' to be the 
"sum" of
> 'ARRIVE' and 'WAIT' in 24 hour format. Also, can anyone direct me to 
some 
> relevant documentation?

You can make a date/time object from

YEAR, WEEK, ARRIVE

by 

mydate <- strptime(paste(....))

see
?strptime

then you can add ARRIVE just by

mydate+ARRIVE*60

(You did not say explicitly what values are ARRIVE so assume minutes)

You shall probably also consult zoo library, especially na.locf function.

Regards
Petr

> 
> Thank you,
> 
> Mike
> [příloha Dataframe.pdf odstraněna uživatelem Petr PIKAL/CTCAP] 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list