Hi,

I have a couple of aggregation operations that I don't know how to
accomplish. Let me give an example. I have the following irregular
time series

time                              x
10:00:00.021                20
10:00:00.224                20
10:00:01.002                19
10:00:02:948                20

1) For each entry time, I'd like to get sum of x for the next 2
seconds (excluding itself). Using the above example, the output should
be

time                        sumx
10:00:00.021                39
10:00:00.224                19
10:00:01.442                20
10:00:02:948                 0

2) For each i-th of x in the series, what's the first passage time to
x[i]-1. I.e. the output should be

time                           firstPassgeTime
10:00:00.021                0.981
10:00:00.224                0.778
10:00:01.442                NA
10:00:02:948                NA

Is there any shortcut function that allows me to do the above? Thank you.

adschai

______________________________________________
R-help@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.

Reply via email to