monitor_selectWhere {AirMonitor} | R Documentation |
Data-based subsetting of time series within an mts_monitor object.
Description
Subsetting of monitor
acts similarly to tidyselect::where()
working on
monitor$data
. The returned mts_monitor object will contain only
those time series where FUN
applied to the time series data returns TRUE
.
Usage
monitor_selectWhere(monitor, FUN)
Arguments
monitor |
mts_monitor object. |
FUN |
A function applied to time series data that returns TRUE or FALSE. |
Value
A subset of the incoming mts_monitor object. (A list with
meta
and data
dataframes.)
See Also
Examples
library(AirMonitor)
# Show all Camp_Fire locations
Camp_Fire$meta$locationName
# Use package US_AQI data for HAZARDOUS
name <- US_AQI$names_eng[6]
threshold <- US_AQI$breaks_PM2.5[6]
# Find HAZARDOUS locations
worst_sites <-
Camp_Fire %>%
monitor_selectWhere(
function(x) { any(x >= threshold, na.rm = TRUE) }
)
# Show the worst locations
worst_sites$meta$locationName
[Package AirMonitor version 0.4.0 Index]