Dear R experts,

I have a large database made up of mixed data types (numeric,
character, factor, ordinal factor) with missing values, and I am
looking for a package that would help me impute the missing values
using  either the mean if numerical or the mode if character/factor.

I maybe could use replace like this:
df$var[is.na(df$var)] <- mean(df$var, na.rm = TRUE)
And go through all the many different variables of the datasets using
mean or mode for each, but I was wondering if there was a faster way,
or if a package existed to automate this (by doing 'mode' if it is a
factor or character or 'mean' if it is numeric)?

I have tried the package "dprep" because I wanted to use the function
"ce.mimp", btu unfortunately it is not available anymore.

Thank you for your help,
-francy

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to