monitor_filterMeta {AirMonitor}R Documentation

General purpose metadata filtering for mts_monitor objects

Description

A generalized metadata filter for mts_monitor objects to choose 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 of monitor$meta where the condition evaluates to NA are dropped. Associated olumns of monitor$data are also dropped for internal consistency in the returned mts_monitor object.

monitor_filter() is an alias for monitor_filterMeta().

Usage

monitor_filterMeta(monitor, ...)

monitor_filter(monitor, ...)

Arguments

monitor

mts_monitor object.

...

Logical predicates defined in terms of the variables in monitor$meta.

Value

A subset of the incoming mts_monitor. (A list with meta and data dataframes.)

Note

Filtering is done on variables in monitor$meta.

See Also

monitor_filterDate

monitor_filterDatetime

Examples

library(AirMonitor)

# Filter based on countyName field
Camp_Fire %>%
  monitor_filter(countyName == "Alameda") %>%
  monitor_timeseriesPlot(main = "All Alameda County Monitors")

# Filter combining two fields
Camp_Fire %>%
  monitor_filter(latitude > 39.5, longitude > -121.5) %>%
  monitor_pull("locationName")

# Filter using string matching
Camp_Fire %>%
  monitor_filter(stringr::str_detect(locationName, "^San")) %>%
  monitor_pull("locationName")


[Package AirMonitor version 0.4.0 Index]