I have two dataframes, one (df1) contains the minimum 'flow' value for specific events observed at different sites. The second dataframe (df2) contains the complete flow rime series.
df1 <- data.frame(Event = as.character(seq(1,9,1)),
Site_ID = rep(c("a","b","c"),each=3),
Flow = rnorm(9,2,1))
df2 <- data.frame(Site_ID = rep(c("a","b","c"),each=20),
Flow = rnorm(60,2,1))
I'd like to use dplyr to go through each 'Flow' value in df1, and calculate its percentile value relative to the complete time series of the corresponding site in df2 using ecdf. Any help would be much appreciated. Thanks.
Here's a method using
group_splitandmap2: