# Impute all numeric columns by their means:
impute_missing(icu)
# Impute numeric columns by median:
impute_missing(
icu,
method = list(where(is.numeric) ~ "median")
)
# Keep only rows where both "vent_mec_no_inv" and "vent_mec" are non-missing:
impute_missing(
icu,
filter_by = c("vent_mec_no_inv", "vent_mec")
)
Run the code above in your browser using DataLab