Skip to contents

This function is specifically meant to ensure that the data in the date_vector specified does not contain dates after a given max_date. The intended use-case for this is to ensure that one doesn't accidentally pass in data that extends beyond the forecast date, as ideally the user is providing vintaged "as of" datasets or at the very least is filtering the data so that they are not including in their inference data that was made available after the forecast was made.

Usage

assert_no_dates_after_max(
  date_vector,
  max_date,
  arg_dates = "y",
  arg_max_date = "x",
  call = rlang::caller_env()
)

Arguments

date_vector

vector of dates

max_date

string indicating the maximum date in ISO8601 convention e.g. YYYY-MM-DD

arg_dates

string to print the name of the data you are checking the dates for

arg_max_date

string to print the name of the maximum date you are checkign the data for

call

Calling environment to be passed to cli::cli_abort() for traceback.

Value

NULL, invisibly