R/pat_filter.R
pat_filter.Rd
A generalized data filter for pat objects to
choose rows/cases where conditions are true. Multiple conditions are
combined with &
or separated by a comma. Only rows where the condition
evaluates to TRUE are kept.Rows where the condition evaluates to NA
are dropped.
pat_filter(pat, ...)
pat | PurpleAir Timeseries pat object. |
---|---|
... | Logical predicates defined in terms of the variables in the
|
A subset of the incoming pat
.
library(AirSensor) unhealthy <- pat_filter(example_pat, pm25_A > 55.5, pm25_B > 55.5) head(unhealthy$data)#> # A tibble: 6 x 19 #> datetime pm25_A pm25_B temperature humidity pressure pm1_atm_A #> <dttm> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 2018-08-03 01:30:00 111. 110. 74 47 NA 66.9 #> 2 2018-08-06 16:46:00 57.4 56.6 72 54 NA 43.0 #> 3 2018-08-14 06:52:00 56.2 59.6 70 57 NA 33.3 #> 4 2018-08-14 07:01:00 56.5 58.0 70 57 NA 33.0 #> 5 2018-08-14 07:04:00 56.6 59.2 70 57 NA 33.3 #> 6 2018-08-14 07:05:00 56.0 59.4 70 58 NA 33.0 #> # … with 12 more variables: pm25_atm_A <dbl>, pm10_atm_A <dbl>, #> # pm1_atm_B <dbl>, pm25_atm_B <dbl>, pm10_atm_B <dbl>, uptime <dbl>, #> # rssi <dbl>, memory <dbl>, adc0 <dbl>, bsec_iaq <dbl>, datetime_A <dttm>, #> # datetime_B <dttm>