handle_missing_values.Rd
Given a dataframe, this function performs the following steps:
Removal of variables with a fraction of missing values greater than the chosen threshold, within each group.
Removal of variables with a fraction of missing values greater than the chosen threshold, for the entire dataframe.
Imputation of the remaining variables.
handle_missing_values(
dat,
covariates,
use_additional_covariates,
selected_covariates,
id_var,
by_var,
threshold_within,
threshold_overall,
method_imputation,
k,
path_save_res
)
A dataframe containing the variables of interest. A dataframe.
A dataframe containing additional variables. A dataframe.
The variable name to be used to identify subjects. A string.
The variable name to group by. A string.
The missing value threshold within each group. An integer.
The overall missing value threshold. An integer.
Number of nearest neighbors used for kNN.
A named list containing the results of the steps described above.
The imputed dataframe is named dat_imputed
.