Skip to contents

This function takes a dataset prepared for mqo calculations and replaces the observation and modelled data columns with a rolling equivalent. Rolling values are calculated within groups of any categorical columns present in the data (likely the "pollutant" and "site" columns, along with any metadata).

Usage

mutate_rolling_mean(
  data,
  window_size = 8L,
  min_coverage = 0.75,
  progress = TRUE,
  dict = mqor::mqo_dict()
)

Arguments

data

An R data.frame containing at least five columns; a numeric column of observed values, a numeric column of modelled values, a character or factor column of identifiers that identify the site associated with the concentrations, a character or factor column of identifiers that identify the pollutant being measured/modelled, and a character or factor column containing just "fixed" or "indicative" to label each site. See demo_shortterm for an example format.

window_size

Integer vector giving rolling window size(s). This is the total number of included values. Defaults to 8L, which is the most useful for ozone statistics.

min_coverage

The minimum data coverage percent, expressed as a decimal (i.e., this option should be between 0 and 1, representing 0% and 100%).

progress

Show a progress bar? Passed to purrr::map().

dict

See mqo_dict() for more information. Acts as a data dictionary to specify the columns in the data {mqor} should use.

See also

openair::rollingMean() for a more flexible and performant version of mutate_rolling_mean().

Other data utilities: filter_year(), mqo_percentile(), summarise_daily(), validate_mod_obs_pairs()