Skip to contents

Keep only the latest contiguous time series, dropping all other NA values from the response variable. Removes test column variables first.

Usage

get_forecast_data(df, response, sort_col, sort_descending, test_col)

Arguments

df

Data frame of model data.

response

Column name of response variable to be used as the input to the forecast function.

sort_col

Column name of column to arrange data by in dplyr::arrange(), prior to filtering for latest contiguous time series and producing the forecast. Not used if NULL, defaults to "year".

sort_descending

Logical value on whether the sorted values from sort_col should be sorted in descending order. Defaults to FALSE.

test_col

Name of logical column specifying which response values to remove for testing the model's predictive accuracy. If NULL, ignored. See model_error() for details on the methods and metrics returned.

Value

A data series.