davidcarslaw / openair

Tools for air quality data analysis
https://davidcarslaw.github.io/openair/
GNU General Public License v2.0
307 stars 113 forks source link

[Feature Request]: Add the rollingMean function as part of the timeAverage #328

Open marcelooyaneder opened 1 year ago

marcelooyaneder commented 1 year ago

Hi, hope everyone is doing well.

I was using a mix of rollingMean and timeAverage function, and this make me think that the function should be inside of the timeAverage. One of the benefits of this change is the use of the type inside of rolling mean.

df8h<-data.frame()

for(station in unique(p$cod.est)){ df8h<-p%>% filter(cod.est==station)%>% rollingMean(pollutant='DatoValidado',new.name = "DatoValidado")%>% bind_rows(df8h) }

p<-df8h%>% timeAverage(avg.time = 'day',data.thresh = 75, statistic = 'max',type=c('cod.est','contaminante'))%>% timeAverage(avg.time = 'year',data.thresh = 75,statistic = 'percentile',percentile=percentile,type=c('cod.est','contaminante'))