View source: R/monitor_replaceValues.R
monitor_replaceValues | R Documentation |
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
replacing negative values with 0
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)
monitor |
mts_monitor object. |
filter |
R expression used to identify values for replacement. |
value |
Numeric replacement value. |
A modified mts_monitor
object. (A list with
meta
and data
dataframes.)
library(AirMonitor)
wa <- monitor_filterMeta(NW_Megafires, stateCode == 'WA')
any(wa$data < 5, na.rm = TRUE)
wa_zero <- monitor_replaceValues(wa, data < 5, 5)
any(wa_zero$data < 5, na.rm = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.