[R] problem with impute.knn

Jianying Li jyli at med.unc.edu
Wed Oct 29 14:22:06 CET 2008


Dear all,

This is my first time using this listserv and I am seeking help from the 
expert. OK, here is my question, I am trying to use impute.knn function 
in impute library and when I tested the sample code, I got the error as 
followingt:

Here is the sample code:
library(impute)
data(khanmiss)
khan.expr <- khanmiss[-1, -(1:2)]
## ## First example
## if(exists(".Random.seed")) rm(.Random.seed)
khan.imputed <- impute.knn(as.matrix(khan.expr))
## ## khan.imputed$data should now contain the imputed data matrix
x<-khan.imputed$data

Here are the results:

 > library(impute)
 > data(khanmiss)
 > khan.expr <- khanmiss[-1, -(1:2)]
 > ## ## First example
 > ## if(exists(".Random.seed")) rm(.Random.seed)
 > khan.imputed <- impute.knn(as.matrix(khan.expr))
Cluster size 2308 broken into 1448 860
Done cluster 1448
Done cluster 860
 > ## ## khan.imputed$data should now contain the imputed data matrix
 > x<-khan.imputed$data
Error in khan.imputed$data : $ operator is invalid for atomic vectors

It seems that khan.imputed$data is empty!! Why is that??

Any help is appreciated,

Jianying Li



More information about the R-help mailing list