monitor_trimDate: Trim a _mts_monitor_ object to full days

View source: R/monitor_trimDate.R

monitor_trimDateR Documentation

Trim a mts_monitor object to full days

Description

Trims the date range of a mts_monitor object to local time date boundaries which are within the range of data. This has the effect of removing partial-day data records at the start and end of the timeseries and is useful when calculating full-day statistics.

By default, multi-day periods of all-missing data at the beginning and end of the timeseries are removed before trimming to date boundaries. If trimEmptyDays = FALSE all records are retained except for partial days beyond the first and after the last date boundary.

Day boundaries are calculated using the specified timezone or, if NULL, from monitor$meta$timezone.

Usage

monitor_trimDate(monitor = NULL, timezone = NULL, trimEmptyDays = TRUE)

Arguments

monitor

mts_monitor object.

timezone

Olson timezone used to interpret dates.

trimEmptyDays

Logical specifying whether to remove days with no data at the beginning and end of the time range.

Value

A subset of the given mts_monitor object. (A list with meta and data dataframes.)

Examples

library(AirMonitor)

# Non-day boundaries
monitor <-
  Camp_Fire %>%
  monitor_filterDatetime(
    "2018111502",
    "2018112206",
    timezone = "America/Los_Angeles"
  )

monitor %>%
  monitor_timeRange(timezone = "America/Los_Angeles")

# Trim to full days only
monitor %>%
  monitor_trimDate() %>%
  monitor_timeRange(timezone = "America/Los_Angeles")


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