Use an R expression to identify values for replacement.

The R expression given in filter is used to identify elements in monitor$data that should be replaced. The datetime column will be retained unmodified. Typical usage would include

  1. replacing negative values with 0

  2. replacing unreasonably high values with NA

Expressions should use data for the left hand side of the comparison.

monitor_replaceValues(monitor = NULL, filter = NULL, value = NULL)

Arguments

monitor

mts_monitor object.

filter

R expression used to identify values for replacement.

value

Numeric replacement value.

Value

A modified mts_monitor object. (A list with meta and data dataframes.)

Examples

library(AirMonitor)

wa <- monitor_filterMeta(NW_Megafires, stateCode == 'WA')
any(wa$data < 5, na.rm = TRUE)
#> [1] TRUE

wa_zero <- monitor_replaceValues(wa, data < 5, 5)
any(wa_zero$data < 5, na.rm = TRUE)
#> [1] FALSE