subset_span {padr}R Documentation

Subset a spanned datetime vector

Description

Take a Date, POSIXct, or POSIXlt vector and subset it by a pattern of date and/or time parts.

Usage

subset_span(spanned, pattern_list)

Arguments

spanned

A vector of class Date, POSIXct, or POSIXlt.

pattern_list

A list with the desired pattern for each of the following datetime parts: year, mon, mday, wday, hour, min, sec.

Details

For subsetting weekdays, they run from 0 (Sunday) to 6 (Saturday).

Value

Vector of the same class as spanned, containing all the data points in spanned that meets the requirements in pattern_list.

Examples

date_span <- span_date(20170701, len_out = 100)
subset_span(date_span, list(wday = 1:5))

time_span <- span_time("20170101 00", 201702)
subset_span(time_span, list(hour = 7:17))
subset_span(time_span, list(hour = c(10, 16), mday = seq(5, 30, 5)))

[Package padr version 0.6.2 Index]