monitor_dailyStatistic: Create daily statistics for each monitor in an _mts_monitor_...

View source: R/monitor_dailyStatistic.R

monitor_dailyStatisticR Documentation

Create daily statistics for each monitor in an mts_monitor object

Description

Daily statstics are calculated for each time series in monitor$data using FUN and any arguments passed in ....

Because the returned mts_monitor object is defined on a daily axis in a specific time zone, it is important that the incoming monitor contain timeseries associated with a single time zone.

Usage

monitor_dailyStatistic(
  monitor = NULL,
  FUN = mean,
  na.rm = TRUE,
  minHours = 18,
  dayBoundary = c("clock", "LST"),
  ...
)

Arguments

monitor

mts_monitor object.

FUN

Function used to create daily statistics.

na.rm

Value passed on to FUN. If FUN does not use na.rm, this should be set to NULL.

minHours

Minimum number of valid hourly records per day required to calculate statistics. Days with fewer valid records will be assigned NA.

dayBoundary

Treatment of daylight savings time: "clock" uses daylight savings time as defined in the local timezone, "LST" uses "local standard time" all year round.

...

Additional arguments to be passed to FUN.

Value

A mts_monitor object containing daily statistical summaries. (A list with meta and data dataframes.)

Note

When dayBoundary = "clock", the returned monitor$data$datetime time axis will be defined in the local timezone (not "UTC") with days defined by midnight as it appears on a clock in that timezone. The transition from DST to standard time will result in a 23 hour day and standard to DST in a 25 hour day.

When dayBoundary = "LST", the returned monitor$data$datetime time axis will be defined in "UTC" with times as they appear in standard time in the local timezone. These days will be one hour off from clock time during DST but every day will consist of 24 hours.

Examples

library(AirMonitor)

Carmel_Valley %>%
  monitor_dailyStatistic(max) %>%
  monitor_getData()

Carmel_Valley %>%
  monitor_dailyStatistic(min) %>%
  monitor_getData()

AirMonitor documentation built on Sept. 27, 2024, 9:06 a.m.