Re: [R] selecting consecutive records over a threshold

2008-02-27 Thread Gabor Grothendieck
Convert the data frame to a zoo object and note that: diff(-rollmax(-z, 2) > 2) > 0 diff(rollmax(z, 2) < 1) > 0 have 1 at the start and end of the storm period respectively so that cumsum of their difference has ones for the storm period. In the last line we extract that portion. # input

[R] selecting consecutive records over a threshold

2008-02-27 Thread Jamie Ledingham
Dear all, I am having trouble working out how I might do the following and would appreciate any thoughts. I am working with data concerning precipitation. The data are in 2 columns in a data frame called "storm" in the following format: HourCount - 1,2,3,4,5,6,7,8,...48 Amt - 0,0,0.3,3,4,8

[R] selecting consecutive records over a threshold

2008-02-27 Thread Jamie Ledingham
Dear all, I am having trouble working out how I might do the following and would appreciate any thoughts. I am working with data concerning precipitation. The data are in 2 columns in a data frame called "storm" in the following format: HourCount - 1,2,3,4,5,6,7,8,...48 Amt - 0,0,0.3,3,4,8