sensor_filterDatetime {AirSensor}R Documentation

Datetime filtering for AirSensor objects

Description

Subsets an AirSensor object by datetime. This function allows for sub-day filtering as opposed to sensor_filterDate() which always filters to day-boundaries. Filtering will be performed with >= startdate and < enddate so that the startdate timestep will be included in the output but the enddate will not.

Datetimes can be anything that is understood by MazamaCoreUtils::parseDatetime(). For non-POSIXct values, the recommended format is "YYYY-mm-dd HH:MM:SS".

Timezone determination precedence assumes that if you are passing in POSIXct times 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 sensor

Usage

sensor_filterDatetime(
  sensor = NULL,
  startdate = NULL,
  enddate = NULL,
  timezone = NULL
)

Arguments

sensor

An AirSensor object.

startdate

Desired start datetime (ISO 8601).

enddate

Desired end datetime (ISO 8601).

timezone

Olson timezone used to interpret dates.

Value

A subset of the given sensor object.

See Also

sensor_filter

sensor_filterDate

Examples

library(AirSensor)

example_sensor %>% 
  sensor_extractData() %>%
  dplyr::pull("datetime") %>%
  range()
  
example_sensor %>% 
  sensor_filterDatetime(
    startdate = "2018-08-21 06:00:00", 
    enddate = "2018-08-28 18:00:00",
    timezone = "UTC"
  ) %>%
  sensor_extractData() %>%
  dplyr::pull("datetime") %>%
  range()


[Package AirSensor version 1.0.8 Index]