This function determines the order of the data rows in the data set. For vector autoregression, you may want to use this to make sure that the data set is sorted by the date/time column, i.e., the supplied id_field parameter is often a measurement index (e.g., 'tijdstip'). The id_field column has to be numeric. This function will also add a squared column to the data frame and include the order_by colum and its squared values as exogenous_variables.

order_by(av_state, id_field, impute_method = c("BEST_FIT", "ONE_MISSING",
"ADD_MISSING", "NONE"))

## Arguments

av_state an object of class av_state the name of a column in the data set this argument has four possible values: 'BEST_FIT' - This is not an imputation method itself, but tells the function to determine the optimal imputation method and use that. This is the default choice for impute_method when it is not specified. 'ONE_MISSING' - Only works when the id_field in each data subset is an integer range with exactly one value missing and exactly one NA value. The NA value is then substituted by the missing index. 'ADD_MISSING' - Does not work when one or more rows have an NA value for id_field. Only works for integer ranges of id_field with single increments. Works by adding rows for all missing values in the range between the minimum and maximum value of id_field. All values in the added rows are NA except for the id_field and the field used for grouping the data (if there was one). 'NONE' - No imputation is performed.

## Value

This function returns the modified av_state object. After the substitutions, the data sets in av_state\$data are sorted by their id_field value. This sorting step moves any rows with value NA for the id_field to the end.

## Examples

# NOT RUN {
# }