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.

Examples

library(AirSensor)

nrow(example_pas)
#> [1] 71

# California
ca <- pas_filter(example_pas, stateCode == "CA")
nrow(ca)
#> [1] 71

# Seal Beach
scsb <- 
  ca %>%
  pas_filter(stringr::str_detect(label, "^SCSB_"))
nrow(scsb)
#> [1] 22

if ( interactive() ) {
  pas_leaflet(ca)

  pas_leaflet(scsb, maptype = "satellite")
}