monitor_dailyThreshold: Daily counts of values at or above a threshold

View source: R/monitor_dailyThreshold.R

monitor_dailyThresholdR Documentation

Daily counts of values at or above a threshold

Description

Calculates the number of hours per day each time series in monitor was at or above a given threshold.

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 only timeseries within a single time zone.

Usage

monitor_dailyThreshold(
  monitor = NULL,
  threshold = NULL,
  na.rm = TRUE,
  minHours = 18,
  dayBoundary = c("clock", "LST")
)

Arguments

monitor

mts_monitor object.

threshold

AQI level name (e.g. "unhealthy") or numerical threshold at and above which a measurement is counted.

na.rm

Logical value indicating whether NA values should be ignored.

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.

Value

A mts_monitor object containing daily counts of hours at or above a threshold value. (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_dailyThreshold("Moderate") %>%
  monitor_getData()

Carmel_Valley %>%
  monitor_dailyThreshold("Unhealthy") %>%
  monitor_getData()


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