Learn R Programming

PWFSLSmoke (version 1.0.16)

monitor_collapse: Collapse a ws_monitor Object into a ws_monitor Object with a Single Monitor

Description

Collapses data from all the monitors in ws_monitor into a single-monitor ws_monitor object using the function provided in the FUN argument. The single-monitor result will be located at the mean longitude and latitude unless longitude and latitude parameters are specified.

Usage

monitor_collapse(ws_monitor, longitude = NULL, latitude = NULL,
  monitorID = "generated_id", FUN = mean, na.rm = TRUE, ...)

Arguments

ws_monitor

ws_monitor object

longitude

longitude of the collapsed monitoring station. (Default = mean of the longitudes)

latitude

latitude of the collapsed monitoring station. (Default = mean of the latitudes)

monitorID

monitor ID of the collapsed monitoring station.

FUN

function to be applied to all the monitors at a single time index.

na.rm

logical value indicating whether NA values should be ignored when FUN is applied

...

additional arguments to be passed on to the apply() function

Value

A ws_monitor object with meta and data that corresponds to the collapsed single monitor

Examples

Run this code
# NOT RUN {
N_M <- Northwest_Megafires
# monitorLeaflet(N_M) # to identify Spokane monitorIDs
Spokane <- monitor_subsetBy(N_M, stringr::str_detect(N_M$meta$monitorID,'^53063'))
Spokane_min <- monitor_collapse(Spokane, monitorID='Spokane_min', FUN=min)
Spokane_max <- monitor_collapse(Spokane, monitorID='Spokane_max', FUN=max)
monitorPlot_timeseries(Spokane, tlim=c(20150619,20150626),
                       style='gnats', shadedNight=TRUE)
monitorPlot_timeseries(Spokane_max, col='red', type='s', add=TRUE)
monitorPlot_timeseries(Spokane_min, col='blue', type='s', add=TRUE)
title('Spokane Range of PM2.5 Values, June 2015')
# }

Run the code above in your browser using DataLab