I have a dataframe with information related to ozone and I need to calculate a stastistic parameter for a single column. This column has the number of days over a year when the daily maximum rolling 8-hour mean ozone concentration is >120 ug/m3 for multiple sites (stations of air pollutants measurement). Using this column, I need to calculate the average for three years taking into account the different sites.
I don't know how to code this, I have think of a loop, but I have no idea.
The result is the mean number of years across one measuring station of ozone concentrations > 120ug/m3 (1 or TRUE). You can extend that of course to n stations.
Well, again a reprex would get me closer, but I'll assume a data frame with colnames() = "station", "year1,", "year2" ... "year_n" where the year columns are logical or 1/0. Since you are only interested in the grand mean,