monitor_dailyStatisticList: Calculate Daily Statistics

View source: R/monitor_dailyStatisticList.R

monitor_dailyStatisticListR Documentation

Calculate Daily Statistics

Description

Calculates daily statistics for each monitor in ws_monitor.

Usage

monitor_dailyStatisticList(
  ws_monitor,
  FUN = get("mean"),
  dayStart = "midnight",
  na.rm = TRUE,
  minHours = 18
)

Arguments

ws_monitor

ws_monitor object

FUN

function used to collapse a day's worth of data into a single number for each monitor in the ws_monitor object

dayStart

one of sunset|midnight|sunrise

na.rm

logical value indicating whether NA values should be ignored

minHours

minimum number of valid data hours required to calculate each daily statistic

Details

Splits the ws_monitor object by timezone and applies the monitor_dailyStatistic() function separately for each timezone. See monitor_dailyStatistic for more details.

The results are returned as a list of ws_monitor objects with each element of the list named with the associated timezone. Note that each ws_monitor$data$datetime will be in local time. This is desirable as it ensures proper date formatting in tables and plots.

You should not attempt to reassemble a single ws_monitor object from the elements in this list.

Value

A list of ws_monitor objects with daily statistics for each local timezone.

References

monitor_dailyStatistic

Examples


# Fail gracefully if any resources are not available
try({

library(PWFSLSmoke)

airnow <- airnow_loadLatest()
nw <- monitor_subset(airnow, stateCodes = c('WA','OR','ID','MT'))
dailyList <- monitor_dailyStatisticList(nw)

monitor_leaflet(dailyList[["America/Los_Angeles"]])

monitor_leaflet(dailyList[["America/Boise"]])

monitor_leaflet(dailyList[["America/Denver"]])

}, silent = FALSE)


MazamaScience/PWFSLSmoke documentation built on July 3, 2023, 11:03 a.m.