我尝试caret
了DMwR
归责。他们都给出了错误
Y = 35
impu = preProcess(dat[, -Y], method = c('knnImpute'))
dat1 = predict(impu, newdata = dat[, -Y])
# Error in `[.data.frame`(old, , non_missing_cols, drop = FALSE) :
# undefined columns selected
dat1 = knnImputation(dat, scale = T, meth='median')
# Error in scale.default(xcomplete, dm[i, ], FALSE) :
# length of 'center' must equal the number of columns of 'x'
数据具有数字、因子和逻辑列。
请在此处下载数据并加载,load('data2013.RData')
谢谢!