
Split a Date Vector into Warm-up, Calibration, and Validation Periods
split_data_set.Rd
Splits a date vector or a data frame with a date column into three time periods: warm-up, calibration, and validation. The function allows for optional adjustment of the calibration and validation periods based on the presence of missing data at the beginning of the time series.
Usage
split_data_set(
df,
start_end_date_vec,
ensure_warm_up = TRUE,
adjust_cal_end = FALSE,
adjust_val_start = FALSE
)
Arguments
- df
A vector of dates (e.g.,
Date
,POSIXt
) or a data frame containing aDatesR
column and aQmm
column (used to detect the first non-NA value).- start_end_date_vec
A character vector of length six, specifying the start and end dates for the warm-up, calibration, and validation periods, in that order.
- ensure_warm_up
Logical. If
TRUE
, adjusts the warm-up period to start at the first non-NA value inQmm
, if applicable. Default isTRUE
.- adjust_cal_end
Logical. If
TRUE
, the end date of the calibration period is adjusted proportionally to the shift in the warm-up period, preserving the original calibration-to-validation duration ratio. This ensures that the calibration period remains representative even if the warm-up period is shifted due to missing data.- adjust_val_start
Logical. If
TRUE
, the start date of the validation period is adjusted to immediately follow the (potentially shifted) calibration period. This ensures continuity between calibration and validation periods when the calibration end date has been modified.