[R] Imputing data

Peter Langfelder peter.langfelder at gmail.com
Sat Dec 3 00:00:03 CET 2011


On Fri, Dec 2, 2011 at 2:16 PM, khlam <khlam at ucsc.edu> wrote:
> So I have a very big matrix of about 900 by 400 and there are a couple of NA
> in the list. I have used the following functions to impute the missing data
>
> data(pc)
> pc.na<-pc
> pc.roughfix <- na.roughfix(pc.na)
> pc.narf <- randomForest(pc.na, na.action=na.roughfix)
>
>
> yet it does not replace the NA in the list.  Presently I want to replace the
> NA with maybe the mean of the rows or columns or some type of correlation.
>
> Any help would be appreciated.

There are several imputation functions available in the various
packages - for example, packages Hmisc and e1071 both contain a
function called impute, and the package impute contains the function
impute.knn for nearest neighbor imputation.

HTH,

Peter



More information about the R-help mailing list