我需要使用impute.knn()
函数的 6 个最近邻和欧几里得距离来计算样本中的缺失值(特定探针集)。我必须在我的数据集中用 NA 替换一个值,然后估算缺失值只是为了测试函数
mat1
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,] 8176.8 8308.4 13002.9 8385.3 8962.8 8391.5 8834.2 10978.4 11863.2 10479 51.7 171.9 581.4 161.4 167.9 25.1 213.2 122.6 81.7 111.8
> mat1[1,4] <- NA
> mat1
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,] 8176.8 8308.4 13002.9 NA 8962.8 8391.5 8834.2 10978.4 11863.2 10479 51.7 171.9 581.4 161.4 167.9 25.1 213.2 122.6 81.7 111.8
> impute.knn(mat1,2)
Error in impute.knn(mat1, 2) :
a column has more than 80 % missing values!
这是我的错误,任何建议将不胜感激