monitor_filterDate {AirMonitor}R Documentation

Date filtering for mts_monitor objects

Description

Subsets a mts_monitor object by date. This function always filters to day-boundaries. For sub-day filtering, use monitor_filterDatetime().

Dates can be anything that is understood by MazamaCoreUtils::parseDatetime() including either of the following recommended formats:

If either startdate or enddate is not provided, the start/end of the mts_monitor time axis will be used.

Timezone determination precedence assumes that if you are passing in POSIXct values then you know what you are doing.

  1. get timezone from startdate if it is POSIXct

  2. use passed in timezone

  3. get timezone from mts_monitor

Usage

monitor_filterDate(
  monitor = NULL,
  startdate = NULL,
  enddate = NULL,
  timezone = NULL,
  unit = "sec",
  ceilingStart = FALSE,
  ceilingEnd = FALSE
)

Arguments

monitor

mts_monitor object.

startdate

Desired start datetime (ISO 8601).

enddate

Desired end datetime (ISO 8601).

timezone

Olson timezone used to interpret dates.

unit

Units used to determine time at end-of-day.

ceilingStart

Logical instruction to apply ceiling_date to the startdate rather than floor_date

ceilingEnd

Logical instruction to apply ceiling_date to the enddate rather than floor_date

Value

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

Note

The returned data will run from the beginning of startdate until the beginning of enddatei.e. no values associated with enddate will be returned. The exception being when enddate is less than 24 hours after startdate. In that case, a single day is returned.

See Also

monitor_filterDatetime

monitor_filterMeta

Examples

library(AirMonitor)

Camp_Fire %>%
  monitor_timeRange()

# Day boundaries returned in "UTC"
Camp_Fire %>%
  monitor_filterDate(
    "2018-11-15",
    "2018-11-22",
    timezone = "America/Los_Angeles"
  ) %>%
  monitor_timeRange()

# Day boundaries returned in "America/Los_Angeles"
Camp_Fire %>%
  monitor_filterDatetime(
    "20181115",
    "20181122",
    timezone = "America/Los_Angeles"
  ) %>%
  monitor_timeRange(
    timezone = "America/Los_Angeles"
  )


[Package AirMonitor version 0.4.0 Index]