powered by
This function handles missing values using specified imputation method. Supports mean, median, and mode imputation for numeric variables.
clean_missing(data, col, method = c("mean", "median", "mode"))
A data.frame with missing values imputed
A data.frame containing survey data
Character string specifying column name to clean
Character string specifying imputation method ("mean", "median", or "mode")
data <- data.frame(age = c(25, NA, 30, NA, 35)) clean_data <- clean_missing(data, "age", method = "mean")
Run the code above in your browser using DataLab