我遇到错误找不到函数“ knnImputation”
答案 0 :(得分:0)
我建议使用 VIM::kNN() 插补,因为包 DMwR 已从 CRAN 中删除:
https://cran.r-project.org/web/packages/DMwR/index.html
# using DMwR::knnImputation
df_mod <- DMwR::knnImputation(df, k = 7)
# VIM approximate equivalent to DMwR
# Note, for numFun you can substitute stats::weighted.mean, they perform similarly, though some differences on the margins I am not sure of
df_mod <- VIM::kNN(df, k = 7, numFun = laeken::weightedMean, weightDist = TRUE)
我在使用 DMwR::knnImputation 的某些情况下遇到了一些挑战,这似乎工作得很好。