order_by.Rd
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"))
av_state | an object of class |
---|---|
id_field | the name of a column in the data set |
impute_method | this argument has four possible values:
|
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.
# NOT RUN { av_state <- load_file("../data/input/RuwedataAngela.sav",log_level=3) av_state <- group_by(av_state,'id') av_state <- order_by(av_state,'tijdstip',impute_method='ONE_MISSING') # }