monitor_mutate {AirMonitor}R Documentation

Apply a function to mts_monitor time series

Description

This function works similarly to dplyr::mutate() and applies FUN to each time series found in monitor$data. FUN must be a function that accepts a numeric vector as its first argument and returns a vector of the same length.

Usage

monitor_mutate(monitor = NULL, FUN = NULL, ...)

Arguments

monitor

mts_monitor object.

FUN

Function used to modify time series.

...

Additional arguments to be passed to FUN.

Value

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

Examples

library(AirMonitor)

Carmel_Valley %>%
  monitor_filterDatetime(2016080207, 2016080212) %>%
  monitor_toCSV(includeMeta = FALSE) %>%
  cat()

Carmel_Valley %>%
  monitor_filterDatetime(2016080207, 2016080212) %>%
  monitor_mutate(function(x) { return(x / 2) }) %>%
  monitor_toCSV(includeMeta = FALSE) %>%
  cat()


[Package AirMonitor version 0.4.0 Index]