date_range: Date_Range

Description Usage Arguments Value Examples

View source: R/sccwrpwbe_functions.R

Description

Takes in df or ts object, start, and end date range and returns df filtered to observations in that time period. Additionally, can take in weekday argument and will only return observations occurring on that weekday. Also will work with abbreviated weekday such as 'Tue'. Function is also pipe compatible with Tidy Verse

Usage

1
date_range(data, start = NULL, end = NULL, weekday = NULL)

Arguments

data

df or time series with Date column

start

Character data type expressing date of form 'YYYY-MM-DD'

end

Character data type of form 'YYYY-MM-DD'

weekday

Character name of weekday e.g. 'Tuesday' or 'Tue'

Value

Returns df filtered to date range defined by inputs

Examples

1
2
3
4
5
6
7
8
#Example For All Days
Hyperion %>% date_range(start='2020-04-20', end = '2020-07-11')

#Example for selecting a weekday only
Hyperion %>% date_range(start='2020-04-20', end = '2020-07-11', weekday='Tuesday')

#Example with abbreviated day
Hyperion %>% date_range(start='2020-04-20', end = '2020-07-11', weekday='Tue')

atki2828/sccwrpwbe documentation built on Dec. 19, 2021, 5:41 a.m.