Skip to content
Back to formatted view

Raw Message

Message-ID: <CAMHWMgLhoWO9WR+VPLDFne+uQ7Q5z3-Xg498ZnA-boQN4zVsNA@mail.gmail.com>
Date: 2011-10-11T12:11:14Z
From: francesca casalino
Subject: Mean or mode imputation fro missing values

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