私はRを初めて使用しますが、マイクロアレイデータセットを持っています。ある場所にNA値があり、library(impute)のimpute.knn()を使用しようとしていますが、行列をimpute.knn()関数で実行すると、別の構造に変わるようです。誰かが何が起こっているのか説明できますか?
> m <- as.matrix(m)
# checking structure
> str(m)
num [1:22283, 1:20] 1942.1 40.1 72.1 4693.6 35.9 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:22283] "1007_s_at" "1053_at" "117_at" "121_at" ...
..$ : chr [1:20] "GSM146778-Normal" "GSM146780-Normal" "GSM146782-Normal"
# checking missing value of cell
> m[x,y]
[1] NA
# impute missing value
> m.i <- impute.knn(m, 6)
# check value of imputed value
> m.i[x,y]
Error in r.imp["206054_at", "GSM146784-Normal"] : incorrect number of dimensions
# check structure of imputed matrix
> str(m.i)
List of 3
$ data : num [1:22283, 1:20] 1942.1 40.1 72.1 4693.6 35.9 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:22283] "1007_s_at" "1053_at" "117_at" "121_at" ...
.. ..$ : chr [1:20] "GSM146778-Normal" "GSM146780-Normal" "GSM146782-Normal" "GSM146784-Normal" ...
$ rng.seed : num 3.62e+08
$ rng.state: int [1:626] 403 50 1992223309 -108730617 1600482030 698744776