View source: R/sts_filterDatetime.R
sts_filterDatetime | R Documentation |
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 is POSIXct
use passed in timezone
get timezone from sts
sts_filterDatetime(
sts = NULL,
startdate = NULL,
enddate = NULL,
timezone = NULL,
unit = "sec",
ceilingStart = FALSE,
ceilingEnd = FALSE,
includeEnd = FALSE
)
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 |
A subset of the incoming sts time series object.
(A list with meta
and data
dataframes.)
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
.
sts_filter
sts_filterDate
library(MazamaTimeSeries)
example_sts %>%
sts_filterDatetime(
startdate = "2018-08-08 06:00:00",
enddate = "2018-08-14 18:00:00"
) %>%
sts_extractData() %>%
head()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.