Calculates statistics associated with the aggregation of raw PurpleAir Timeseries data onto a regular time axis.

Temporal aggregation involves creating time period bins defined by period and then calculating the statistics associated with the raw data measurements that fall within each bin. The result is a dataframe with a regular time axis and multiple columns of output for every column of input.

Each of the pat object data columns will result in the following basic statistics:

  1. mean

  2. median

  3. sd

  4. min

  5. max

  6. count

For the paired pm25_A and pm25_B data columns, the following additional statistics are generated by applying a two-sample t-test to the A and B channel data in each bin:

  1. pm25_t -- t-test statistic

  2. pm25_p -- p-value

  3. pm25_df -- degrees of freedom

These statistics are used to assign aggregate (hourly) values, (e.g. temperature_mean). They can also be used to invalidate some aggregate values based on sd, count or pm25_t.

pat_aggregate_old(pat = NULL, period = "1 hour")

Arguments

pat

PurpleAir Timeseries pat object.

period

Time period to average to. Can be "sec", "min", "hour", "day", "DSTday", "week", "month", "quarter" or "year". A number can also precede these options followed by a space (i.e. "2 day" or "37 min").

Value

Returns a dataframe with aggregation statistics.

Examples

if (FALSE) { df <- pat_aggregate(example_pat, "1 hour") head(df) }