CFsubset {CFtime}R Documentation

Which time steps fall within two extreme values

Description

Given two extreme character timestamps, return a logical vector of a length equal to the number of time steps in the CFtime instance with values TRUE for those time steps that fall between the two extreme values, FALSE otherwise. This can be used to select slices from the time series in reading or analysing data.

Usage

CFsubset(x, extremes)

Arguments

x

CFtime. The time series to operate on.

extremes

character. Vector of two timestamps that represent the extremes of the time period of interest. The timestamps must be in increasing order. The timestamps need not fall in the range of the time steps in the CFtime stance.

Value

A logical vector with a length equal to the number of time steps in x with values TRUE for those time steps that fall between the two extreme values, FALSE otherwise. The earlier timestamp is included, the later timestamp is excluded. A specification of c("2022-01-01", "2023-01-01") will thus include all time steps that fall in the year 2022.

Examples

cf <- CFtime("hours since 2023-01-01 00:00:00", "standard", 0:23)
CFsubset(cf, c("2022-12-01", "2023-01-01 03:00"))

[Package CFtime version 1.3.0 Index]