knnImputation(data, k = 10, scale = T, meth = "weighAvg", distData = NULL)
data
If meth='median'
the function will use either the median (in
case of numeric variables) or the most frequent value (in case of
factors), of the neighbours to fill in the NAs. If
meth='weighAvg'
the function will use a weighted average of the
values of the neighbours. The weights are given by exp(-dist(k,x)
where dist(k,x)
is the euclidean distance between the case with
NAs (x) and the neighbour k.
centralImputation
, centralValue
, complete.cases
, na.omit
data(algae) cleanAlgae <- knnImputation(algae) summary(cleanAlgae)