Is a specialized function which takes a variable and turns it into two new variables to be used in a prediction model.
the variable for which missing values are imputed by the median for the given year.
an indicator when the variable is missing
na_impute_median(data, var, year = 2014, year_column)
The data frame.
The variable used to create new variables.
Year used for the median for imputation.
Column with year to use median on.
New data frame in which missing values are filled.