Learn R Programming

AirSensor (version 1.0.8)

PurpleAirQC_hourly_AB_03: Apply hourly aggregation QC using "AB_O4" algorithm

Description

Creates a pm25 timeseries by averaging aggregated data from the A and B channels and applying the following QC logic:

  1. Create pm25 by averaging the A and B channel aggregation means

  2. Invalidate data where: (min_count < 20)

  3. Invalidate data where: (A/B hourly difference > 5 AND A/B hourly percent difference > 70%)

  4. Invalidate data where: (A/B hourly data recovery < 90%)

Usage

PurpleAirQC_hourly_AB_03(pat = NULL, min_count = 20, returnAllColumns = FALSE)

Arguments

pat

A PurpleAir timeseries object.

min_count

Aggregation bins with fewer than min_count measurements will be marked as NA.

returnAllColumns

Logical specifying whether to return all columns of statistical data generated for QC algorithm or just the final pm25 result.

Value

Data frame with columns datetime and pm25.

Examples

Run this code
# NOT RUN {
library(AirSensor)

df_00 <- 
  example_pat_failure_A %>%
  pat_qc() %>%
  PurpleAirQC_hourly_AB_00()
  
df_01 <- 
  example_pat_failure_A %>%
  pat_qc() %>%
  PurpleAirQC_hourly_AB_01()
  
df_03 <- 
  example_pat_failure_A %>%
  pat_qc() %>%
  PurpleAirQC_hourly_AB_03()
  
layout(matrix(seq(2)))

plot(df_00, pch = 16, cex = 0.8, col = "red")
points(df_01, pch = 16, cex = 0.8, col = "black")
title("example_pat_failure_A -- PurpleAirQC_hourly_AB_01")

plot(df_00, pch = 16, cex = 0.8, col = "red")
points(df_03, pch = 16, cex = 0.8, col = "black")
title("example_pat_failure_A -- PurpleAirQC_hourly_AB_03")

layout(1)
# }

Run the code above in your browser using DataLab