pas_filterDate: Date filtering for PurpleAir Synoptic objects

View source: R/pas_filterDate.R

pas_filterDateR Documentation

Date filtering for PurpleAir Synoptic objects

Description

Subsets a pas object by date.

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

  • "YYYYmmdd"

  • "YYYY-mm-dd"

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

Usage

pas_filterDate(pas = NULL, startdate = NULL, enddate = NULL, timezone = NULL)

Arguments

pas

PurpleAir Synoptic pas object.

startdate

Desired start datetime (ISO 8601).

enddate

Desired end datetime (ISO 8601).

timezone

Optional Olson timezone used to interpret dates.

Note

The incoming pas object must contain the date_created and last_modified fields. The returned pas object will retain sites where startdate <= last_seen && enddate >= pas$date_created.

See Also

pas_filter

Examples

library(AirSensor2)

august_2018 <-
 example_pas_historical %>%
  pas_filterDate(
    startdate = 20180701,
    enddate = 20181101,
    timezone = "America/Los_Angeles"
 )

fields <- c("sensor_index", "name", "date_created", "last_seen")
head(august_2018[,fields])


MazamaScience/AirSensor2 documentation built on Oct. 31, 2024, 1:39 a.m.