R/PurpleAirSoH_dailyToIndex_00.R
PurpleAirSoH_dailyToIndex_00.Rd
This function calculates a multi-metric index based on the data
in SoH
dataframe passed in. A tibble is returned containing a state of
health index for each day. 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:
If the A or B channel percent reporting is < minPctReporting
, index = 0
Otherwise, index = pm25_A_pm25_B_rsquared
The breaks
are used to convert index
into the indenx_bin
poor-fair-good values.
PurpleAirSoH_dailyToIndex_00( SoH = NULL, minPctReporting = 50, breaks = c(0, 0.2, 0.8, 1) )
SoH | PurpleAir daily State-of-Health dataframe. |
---|---|
minPctReporting | Percent reporting threshold for A and B channels. |
breaks | Breaks used to convert index values into index bins. |
# \donttest{ library(AirSensor) tbl <- example_pat_failure_A %>% pat_dailySoH() %>% PurpleAirSoH_dailyToIndex_00() head(tbl)#> # A tibble: 6 x 3 #> datetime index index_bin #> <dttm> <dbl> <int> #> 1 2019-04-01 00:00:00 0.891 3 #> 2 2019-04-02 00:00:00 0.852 3 #> 3 2019-04-03 00:00:00 0.917 3 #> 4 2019-04-04 00:00:00 0.00420 1 #> 5 2019-04-05 00:00:00 0.706 2 #> 6 2019-04-06 00:00:00 0.0403 1# }