Date_Roller: Date_Roller

View source: R/Date_Roller.R

Date_RollerR Documentation

Date_Roller

Description

Creates a list of rolling date entries to be used easily using a map call. It will start at first date, look ahead N periods and create the first list entry. Thereafter it drops first entry, and adds next. This keeps a constant N length rolling window. See my question on stack here: https://stackoverflow.com/q/54733427/4198868

Usage

Date_Roller(DateVec, N = 24)

Arguments

DateVec

Any arranged vector of dates. Function will sort your date vector just in case you forget...

N

Rolling N periods.

Value

Vector of dates to be used in map.

Examples

library(tidyverse);library(lubridate);library(rmsfuns)
DateVec <- rmsfuns::dateconverter(lubridate::ymd(20020101), lubridate::ymd(20200131), Transform = "weekdayEOM")
Rolldates <- Date_Roller(DateVec, N = 24)

Nicktz/fmxdat documentation built on Aug. 25, 2024, 10:18 a.m.