A generalized data filter for pas objects to choose rows/cases where conditions are true. Rows where the condition evaluates to NA are dropped.

pas_filter(pas, ...)

Arguments

pas

PurpleAir Synoptic pas object.

...

Logical predicates defined in terms of the variables in the pas. Multiple conditions are combined with & or seperated by a comma. Only rows where the condition evaluates to TRUE are kept.

Value

A subset of the given pas object.

See also

Examples

library(AirSensor) nrow(example_pas)
#> [1] 16584
# California ca <- pas_filter(example_pas, stateCode == "CA") nrow(ca)
#> [1] 10507
# Seal Beach scsb <- ca %>% pas_filter(stringr::str_detect(label, "^SCSB_")) nrow(scsb)
#> [1] 54
if ( interactive() ) { pas_leaflet(ca) pas_leaflet(scsb, maptype = "satellite") }