[R] how to use tune.knn() for dataset with missing values

From: David Meyer <david.meyer_at_wu-wien.ac.at>
Date: Fri 07 Oct 2005 - 00:37:12 EST

Well, since knn() can't handle incomplete data as it says, you can choose to either omit incomplete observations (e.g., using na.omit()), or to impute the data if the conditions are met (missingness at random, ...); see, e.g., packages cat, mix, norm, and e1071 for that.

HTH,
David


Hi Everybody,

i again have the problem in using tune.knn(), its giving an error saying

missing values are not allowed.... again here is the script for BreastCancer Data,

library(e1071)
library(mda)

trdata<-data.frame(train,row.names=NULL) attach(trdata)

xtr <- subset(trdata, select = -Class)
ytr <- Class

bestpara <-tune.knn(xtr,ytr, k = 1:25, tunecontrol = tune.control(sampling
= "cross"))

and here i got the mentioned error.

can anybody help me in this regard...

Thanks & Regards,

Uttam Phulwale
Tata Consultancy Services Limited
Mailto: uttam.phulwale@tcs.com
Website: http://www.tcs.com



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Oct 06 22:40:57 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:24:46 EST