sts_filterDatetime {MazamaTimeSeries} | R Documentation |
Datetime filtering for sts time series objects
Description
Subsets a MazamaSingleTimeseries object by datetime. This function
allows for sub-day filtering as opposed to sts_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
values then you know what you are doing.
get timezone from
startdate
if it isPOSIXct
use passed in
timezone
get timezone from
sts
Usage
sts_filterDatetime(
sts = NULL,
startdate = NULL,
enddate = NULL,
timezone = NULL,
unit = "sec",
ceilingStart = FALSE,
ceilingEnd = FALSE,
includeEnd = FALSE
)
Arguments
sts |
MazamaSingleTimeseries sts 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
|
ceilingEnd |
Logical instruction to apply
|
includeEnd |
Logical specifying that records associated with |
Value
A subset of the incoming sts time series object.
(A list with meta
and data
dataframes.)
Note
The returned sts
object will contain data running from the
beginning of startdate
until
the beginning of enddate
– i.e. no values associated
with enddate
will be returned. To include enddate
you can
specify includeEnd = TRUE
.
See Also
Examples
library(MazamaTimeSeries)
example_sts %>%
sts_filterDatetime(
startdate = "2018-08-08 06:00:00",
enddate = "2018-08-14 18:00:00"
) %>%
sts_extractData() %>%
head()