Perform multiple imputation on a list of data frames and combine the results
Source:R/impute_and_combine.R
impute_and_combine.Rd
This function takes a list of data frames, performs multiple imputation to fill in missing values using the 'mice' package, and combines the imputed datasets into a single dataset. The imputations are performed separately for each data frame in the list, and the results are combined into a 'mids' object, which is then cleaned and returned.
Usage
impute_and_combine(
list_df,
m = 10,
exclude_vars = c("t0_sample_frame", "id", "t0_sample_origin_names_combined")
)
Value
A data frame that combines all imputed datasets, with unnecessary columns removed and row names reset.
Examples
if (FALSE) { # \dontrun{
# Assuming list_df is a list of data frames with missing values
imputed_data <- impute_and_combine(list_df, m = 5)
print(imputed_data)
} # }