hsFilterPeriod: Filter Rows Within Time Period

View source: R/hsLibBase.R

hsFilterPeriodR Documentation

Filter Rows Within Time Period

Description

Filters a data.frame containing time series data for the time interval between minDate and maxDate.

Usage

hsFilterPeriod(
  tSeries,
  minDate,
  maxDate,
  tsField,
  maxIncluded = FALSE,
  dbg = FALSE
)

Arguments

tSeries

data.frame containing time-series data.

minDate

lower boundary of time interval to be selected, as either of POSIXt-object, Date object or string in ISO format: yyyy-mm-dd

maxDate

upper boundary of time interval to be selected, as either of POSIXt-object, Date object or string in ISO format: yyyy-mm-dd

tsField

name of time stamp column in tseries.

maxIncluded

if TRUE, maxDate is included in the time interval to be filtered for, otherwise it is not included (see Details).

dbg

if TRUE debug messages are shown

Details

minDate and maxDate must be given as character string in ISO format: “yyyy-mm-dd [HH:MM:SS]”, where the brackets indicate that time information is optional. The lower boundary is always included in the time interval to be selected, whereas the upper boundary is only included if maxIncluded is TRUE and otherwise excluded. With maxIncluded = FALSE it is easy to select whole months or whole years by setting maxDate to the first day of the next month/year.

Value

Returns tSeries, reduced to rows representing a time within the selected time interval between minDate and maxDate


KWB-R/kwb.base documentation built on June 19, 2022, 3:30 a.m.