[R] how to cumulate up times

René Mayer mayer at psychologie.tu-dresden.de
Tue Apr 24 18:15:01 CEST 2012


Thanks Michael,
cumsum - yes of course!
Regards,
René


Zitat von "R. Michael Weylandt" <michael.weylandt at gmail.com>:

> ? cumsum
>
> something like
>
> library(chron) # Reporting packages you use is always considerate
> mt <- times(c('00:05:00', '00:15:00', '00:30:00')) # Spaces are legible!
>
> times("09:30:00") + cumsum(mt)
>
> Michael
>
> On Tue, Apr 24, 2012 at 11:35 AM, René Mayer
> <mayer at psychologie.tu-dresden.de> wrote:
>> Dear List,
>> given a vecor of times in 5,15 and 30 minutes and a start point
>> in time, lets say 09:30:00, how do I add up those times
>> to the start time getting a cumulative time sequence?
>>
>> mt<-times(c('00:05:00', '00:15:00', '00:30:00'))
>> mt       wanted
>> 00:05:00 09:35:00
>> 00:15:00 09:50:00
>> 00:30:00 10:20:00
>>
>> Regards,
>> René
>>
>> ______________________________________________
>> 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