pat_qc {AirSensor}R Documentation

Apply quality control on PurpleAir Timeseries object


Optionally applies QC thresholds to a pat object based on the documented specs of the PurpleAir sensor.

The pat_load() function returns raw "engineering" data for a PurpleAir Sensor. The very first level of QC that should always be applied is the removal of out-of-spec values that should never be generated by the sensor components. Out-of-spec values imply an electrical or software problem and can never be considered valid measurements.

Setting a max_humidity threshold is less fundamental. There are many cases where PM2.5 readings during periods of high humidity should be called into question which is why this QC option is provided. However, this type of filtering is dependent upon a properly functioning humidity sensor. Humidity filtering is disabled by default because it can result in the invalidation of many potentially valid PM2.5 measurements.


pat_qc(pat = NULL, removeOutOfSpec = TRUE, max_humidity = NULL)



PurpleAir Timeseries pat object


Logical determining whether measurements that are out of instrument specs should be invalidated.


Maximum humidity threshold above which pm25 measurements are invalidated. Disabled unless explicitly set.


Out of spec thresholds are set so that anything outside of these the given range should represent a value that is not physically possible in an ambient setting on planet Earth.


A cleaned up pat object.


PA-II specs



# Use a sensor with problems
pat <- example_pat_failure_A

# Basic plot shows out-of-spec values for humidity
pat %>% pat_multiPlot(sampleSize = NULL)

# Applying QC removes these records
pat %>% pat_qc() %>% pat_multiPlot(sampleSize = NULL)

# We can also remove PM2.5 data at high humidities
pat %>% pat_qc(max_humidity = 80) %>% pat_multiPlot(sampleSize = NULL)

[Package AirSensor version 1.0.8 Index]