Xumin Zeng
2010-Mar-08 21:29 UTC
[R] error when using svm routine: Error in if (any(co)) { : missing value where TRUE/FALSE needed
Hi, I met with this error message with the following data set. Do you know how to resolve it? Thanks.> data<-read.table("c://temp3//abc.csv", sep = ",", header=T) > classwt<-c( 0.5806452, 0.4193548) > y<-data[,1] > x<-data[,2:ncol(data)] > print(y)[1] 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 1 1 1 1 1 [36] 1 1 1 1 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2> print(x)rs2289472 rs1551398 rs7927894 1 CT AA CT 2 TT AA CC 3 TT AG TT 4 TT AA CT 5 CC AA CT 6 CT AA CT 7 TT AA CT 8 CT AG CT 9 CC AA CT 10 TT AG TT 11 CT GG CC 12 CT GG CC 13 CT AG CC 14 CT AG TT 15 CT AA CT 16 TT AA CT 17 CT AG CT 18 TT AA CT 19 TT AA TT 20 CT AG CT 21 CT AG TT 22 CT AA CT 23 TT AA CT 24 CC AA CC 25 CT AG CC 26 CT AG CT 27 CT GG CT 28 CT AG CC 29 CT GG CC 30 TT GG CT 31 CT AG CT 32 TT AG TT 33 CC GG CC 34 TT AA CT 35 CT GG TT 36 TT AG CT 37 CT AG CC 38 TT AA CC 39 TT AA TT 40 TT AA TT 41 CT GG CT 42 CT AG TT 43 TT AA CT 44 CT AG CC 45 TT AG CC 46 CT AA CC 47 CC AA CT 48 CT AA CT 49 CC AA CC 50 TT AA TT 51 TT GG CT 52 CT AG CT 53 TT AG TT 54 TT AA CT 55 CT AA CC 56 CT AG CT 57 CT AG CC 58 CT AA CC 59 CT AG CC 60 CT AG TT 61 TT AA CC 62 TT GG CT> svm.fit=svm(y=as.factor(y),x=x,class.weights = classwt)Error in if (any(co)) { : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In FUN(newX[, i], ...) : NAs introduced by coercion 2: In FUN(newX[, i], ...) : NAs introduced by coercion 3: In FUN(newX[, i], ...) : NAs introduced by coercion>Xumin [[alternative HTML version deleted]]