A generalized data filter for sensor objects to
choose rows/cases where conditions are true. Multiple conditions are
combined with &
or seperated by a comma. Only rows where the condition
evaluates to TRUE are kept.Rows where the condition evaluates to NA
are dropped.
sensor_filter(sensor = NULL, ...)
An AirSensor object.
Logical predicates defined in terms of the variables in
sensor$data
.
A subset of the incoming sensor.
Filtering predicates are applied to the data
dataframe within
the sensor object.
library(AirSensor)
teens <- sensor_filter(example_sensor,
example_sensor$data$`6f71a0c5f076deda_9392` < 20,
example_sensor$data$`6f71a0c5f076deda_9392` >= 10)
head(teens$data)
#> datetime 6f71a0c5f076deda_9392
#> 1 2022-07-01 05:00:00 12.07950
#> 2 2022-07-01 06:00:00 11.17250
#> 3 2022-07-01 07:00:00 13.56950
#> 4 2022-07-01 08:00:00 11.53033
#> 5 2022-07-01 09:00:00 14.11150
#> 6 2022-07-01 10:00:00 16.02233