How to get maximum 30-minute rainfall intensity for each event?

I have a time-series data as in the link below
I have tried the following code to get 30-minute maximum rainfall intensity for each event.
Here, one event is counted when there is a gap of more than 6 hours of 0 value rainfall.

df <- read.csv("rainfall.csv", header = TRUE)
df$time=as.POSIXct(datetime,format="%Y-%m-%dT %H:%M:%SZ")
df <- df[,c("time","")]
time2=Lag(df$time, shift = 1)
df$dur=as.numeric(difftime(time1, time2, units = "hours"))
df=df %>%
  group_by(Event = as.integer
               (cumsum(dur > 6), default = 0)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.