set_dates: Create a data.table with 3,6,9,12 month periods

Description Usage Arguments Examples

View source: R/set_dates.R

Description

This function returns a 24x5 data.table; the first column is the 24 effective periods, the second to fifth columns assign each effper to either 'current' or 'prior' depending on the rolling window. The second column col is the 3 month rolling window and the others are identified by their number

Usage

1
set_dates(last_month)

Arguments

last_month

A character or Date object, formatted "%Y-%m-%d". Ensure it is the first day of the final effective period.

Examples

1
2
3
last_month <- as.Date('2019-02-01') or last_month <- '2019-02-01'
dates_df <- set_dates(last_month)
dates_df[!is.na(col), .(effper, col)] #could then be used to merge on to keep only certain effpers

joshua-ruf/fidelis documentation built on July 20, 2019, 1:56 a.m.