monitor_replaceValues: Replace _mts_monitor_ data with another value

View source: R/monitor_replaceValues.R

monitor_replaceValuesR Documentation

Replace mts_monitor data with another value

Description

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.

Usage

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

Arguments

monitor

mts_monitor object.

filter

RR 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)

wa_zero <- monitor_replaceValues(wa, data < 5, 5)
any(wa_zero$data < 5, na.rm = TRUE)

AirMonitor documentation built on Aug. 26, 2023, 1:08 a.m.