Learn R Programming

MazamaTimeSeries (version 0.3.0)

sts_filterDate: Date filtering for sts time series objects

Description

Subsets a MazamaSingleTimeseries object by date. This function always filters to day-boundaries. For sub-day filtering, use sts_filterDatetime().

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

  3. get timezone from sts

Usage

sts_filterDate(
  sts = NULL,
  startdate = NULL,
  enddate = NULL,
  timezone = NULL,
  unit = "sec",
  ceilingStart = FALSE,
  ceilingEnd = FALSE
)

Value

A subset of the incoming sts time series object. (A list with meta and data dataframes.)

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 ceiling_date to the startdate rather than floor_date

ceilingEnd

Logical instruction to apply ceiling_date to the enddate rather than floor_date

See Also

sts_filter

sts_filterDatetime

Examples

Run this code
library(MazamaTimeSeries)

example_sts %>%
  sts_filterDate(startdate = 20180808, enddate = 20180815) %>%
  sts_extractData() %>%
  head()

Run the code above in your browser using DataLab