This function generates lagged versions of all columns in a given data frame. It creates new columns for each lag, allowing time series data to be structured in a way that includes previous time steps as predictors.
Value
A data frame containing the original data and the lagged versions of the variables. The lagged columns
are named in the format <column_name>_lag_<lag>.
Details
This function takes a data frame and creates new columns that are lagged versions of the original columns.
The number of lags is specified by the lags argument. The function creates new columns for each lag value,
appending the lag number to the original column names.
Examples
if (FALSE) { # \dontrun{
# Example usage of create_lagged_data:
data <- data.frame(var1 = 1:10, var2 = 11:20)
make_lagged_data(data, lags = 1:2)
} # }
