powered by
Replace NAs in numeric variables using simple methods or mice-based imputation.
NA
mice
impute_missing( data, method = c("mean", "median", "mice"), m = 5, seed = 123, ... )
A data frame with missing values imputed.
A numeric matrix or data frame.
Character; one of "mean", "median", or "mice". Default: "mean".
"mean"
"median"
"mice"
Integer; number of multiple imputations when method = "mice". Default: 5.
method = "mice"
Integer; random seed for mice imputation. Default: 123.
Additional arguments passed to mice::mice when method = "mice".
mice::mice
if (FALSE) { df <- data.frame(x = c(1, NA, 3), y = c(4, 5, NA)) impute_missing(df, method = "mice") }
Run the code above in your browser using DataLab