Learn R Programming

pguIMP (version 0.0.0.3)

knnImputation: knnImputation

Description

Imputes missings using kNN.

Usage

knnImputation(data, k = 10, scale = TRUE, meth = "weighAvg", distData = NULL)

Arguments

data

data frame containing missing values

k

number of nearest neighbors

scale

Indicates if data should be scaled

meth

Method for estimating the missing value

distData

Distance to the case

Value

cleaned data

Details

Function that fills in all unknowns using the k Nearest Neighbours of each case with unknows. By default it uses the values of the neighbours and obtains an weighted (by the distance to the case) average of their values to fill in the unknows. If meth='median' it uses the median/most frequent value, instead. Taken from https://github.com/ltorgo/DMwR2/

Examples

Run this code
# NOT RUN {
centralValue(x = seq(1,10,1))

# }

Run the code above in your browser using DataLab