date_from_lag: Generates an initial date from a reference date and a time...

View source: R/month_id.R

date_from_lagR Documentation

Generates an initial date from a reference date and a time lag in months

Description

Generates an initial date from a reference date and a time lag in months

Usage

date_from_lag(date = character(), time_lag = integer())

Arguments

date

a date with format yyyy-mm-dd

time_lag

an integer representing a number of months

Value

a date which is time_lag months before or after date depending on the sign of time_lag

Examples

seq_dates <- seq(as.Date("2020-01-01"),
 as.Date("2020-12-01"),
 by = "1 month")

data.frame(date = seq_dates,
 lagged_date = date_from_lag(
  date = seq_dates,
  time_lag = -2))

AurMad/STOCfree documentation built on Sept. 13, 2022, 3:20 a.m.