R/pat_filterDatetime.R
pat_filterDatetime.Rd
Subsets a PurpleAir Timeseries object by datetime. This function
allows for sub-day filtering as opposed to pat_filterDate()
which
always filters to day-boundaries.
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.
get timezone from startdate
if it is POSIXct
use passed in timezone
get timezone from pat
pat_filterDatetime(
pat = NULL,
startdate = NULL,
enddate = NULL,
timezone = NULL
)
PurpleAir Timeseries pat object.
Desired start datetime (ISO 8601) or POSIXct
.
Desired end datetime (ISO 8601) or POSIXct
.
Olson timezone used to interpret dates.
A subset of the given pat object.
library(AirSensor)
example_pat %>%
pat_filterDatetime(
startdate = "2022-07-02 06:00:00",
enddate = "2022-07-05 18:00:00"
) %>%
pat_multiPlot()