This function calculates the pat_dailySoH function and returns a tibble containing a state of health index for each day of the pat provided. The returned tibble contains columns: datetime, index, and index_bin.

The index column contains a value normalized between 0 and 1 where 0 represents low confidence in the sensor data and 1 represents high confidence. The index_bin is one of 1, 2, or 3 and represents poor, fair, and good data respectively.

The index is calculated in the following manner:

  1. If the A or B channel percent reporting is < minPctReporting, index = 0

  2. Otherwise, index = pm25_A_pm25_B_rsquared

The breaks are used to convert index into the index_bin poor-fair-good values.

pat_dailySoHIndex_00(
  pat = NULL,
  minPctReporting = 50,
  breaks = c(0, 0.2, 0.8, 1)
)

Arguments

pat

PurpleAir Timeseries pat object.

minPctReporting

Percent reporting threshold for A and B channels.

breaks

Breaks used to convert index values into index bins.

Examples

# \donttest{
library(AirSensor)

tbl <-
  example_pat %>%
  pat_dailySoHIndex_00()

head(tbl)
#> # A tibble: 6 × 3
#>   datetime              index index_bin
#>   <dttm>                <dbl>     <int>
#> 1 2022-06-30 00:00:00 0               1
#> 2 2022-07-01 00:00:00 0.0803          1
#> 3 2022-07-02 00:00:00 0.0188          1
#> 4 2022-07-03 00:00:00 0.00517         1
#> 5 2022-07-04 00:00:00 0               1
#> 6 2022-07-05 00:00:00 0               1
# }