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.

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()
#> # A tibble: 24 × 2
#>    datetime            a9572a904a4ed46d_840060530002
#>    <dttm>                                      <dbl>
#>  1 2016-07-22 00:00:00                             7
#>  2 2016-07-23 00:00:00                            17
#>  3 2016-07-24 00:00:00                            30
#>  4 2016-07-25 00:00:00                            32
#>  5 2016-07-26 00:00:00                           265
#>  6 2016-07-27 00:00:00                            56
#>  7 2016-07-28 00:00:00                            58
#>  8 2016-07-29 00:00:00                            44
#>  9 2016-07-30 00:00:00                            36
#> 10 2016-07-31 00:00:00                            84
#> # ℹ 14 more rows

Carmel_Valley %>%
  monitor_dailyStatistic(min) %>%
  monitor_getData()
#> # A tibble: 24 × 2
#>    datetime            a9572a904a4ed46d_840060530002
#>    <dttm>                                      <dbl>
#>  1 2016-07-22 00:00:00                             0
#>  2 2016-07-23 00:00:00                             0
#>  3 2016-07-24 00:00:00                             0
#>  4 2016-07-25 00:00:00                             9
#>  5 2016-07-26 00:00:00                             2
#>  6 2016-07-27 00:00:00                             1
#>  7 2016-07-28 00:00:00                             0
#>  8 2016-07-29 00:00:00                             1
#>  9 2016-07-30 00:00:00                             0
#> 10 2016-07-31 00:00:00                             6
#> # ℹ 14 more rows