All, I am beginner in R here.I am working on SVM and am getting the below errors wheneverI call the predict function.I have tried reading the manual for predict() butI am totally stumped and not able to move further.
> pred <- predict(model, Test[,-1])Error in scale(newdata[, object$scaled, drop > = FALSE], center = object$x.scale$"scaled:center", : (subscript) logical > subscript too long The actual data sets are very huge , hence I am > replicating it on a smaller basis. My dataset contains lots of 'NA' values. The code I am calling is > TrainingSet <- read.csv('TrainA.csv',header=TRUE)> TestingSet <- read.csv('TestA.csv',header=TRUE) > Train <- subset(TrainingSet, select=c(-Class)) > Train_Class <- > subset(TrainingSet, select=Class) > Test <- subset(TestingSet, select=c(-Class))> Test_Class <- > subset(TestingSet, select=Class) > model <- svm(Train[,-1], Train_Class, kernel="linear", cross=10, > na.action=na.omit)> model Call:svm.default(x = Train[, -1], y = Train_Class, kernel = "linear", cross = 10, na.action = na.omit) Parameters: SVM-Type: eps-regression SVM-Kernel: linear cost: 1 gamma: 0.3333333 epsilon: 0.1 Number of Support Vectors: 18 > Class <- Test_Class$Class> pred <- predict(model, Test[,-1])Error in > scale(newdata[, object$scaled, drop = FALSE], center = > object$x.scale$"scaled:center", : (subscript) logical subscript too long Training data set: Gene_Symbol Class Subj-1 Subj-2 Subj-313CDNA73 0 0.225 -0.378 0.92720D7-FC4 0 1.668 1.762 1.445384D8-2 0 0.52 -1.019 1.58854TM 0 3.094 5.114 2.7435T4 0 -1.138 1.158 0.0176P 0 1.588 -2.541 -1.023A 0 -0.649 -1.884 1.253A2LP 0 1.765 3.75 -0.259AAMP 0 -1.133 -0.309 -1.557AARS 1 3.132 0.432 2.4AB026190 1 -0.244 -0.06 -0.021ABCA3 1 -0.003 -1.673 1.272ABCA4 1 -1.017 -0.493 -0.751ABCA5 1 3.319 3.234 0.503ABCA6 1 2.692 0.039 4.017ABCB1 1 0.362 -0.362 0.862ABCB10 1 0.028 -1.962 -0.795ABCC1 1 1.963 3.475 0.202ABCC2 1 -0.942 -3.496 0.297 Test Gene_Symbol Class Subj-1 Subj-2RBP3 0 -0.762 -1.132RBP4 0 0.494 3.802RBPMS 0 -0.311 0.612RBSK 0 -0.759 1.206RBX1 0 0.047 -0.31RCD-8 0 -0.42 -3.001RCL 1 -0.388 1.046RCN1 1 0.476 -1.092RCN2 1 -0.469 -0.707RCV1 1 -2.071 -0.854RDBP 1 0.904 1.325RDC1 1 1.668 1.905REA 1 0.09 -0.531RECQL 1 -1.957 -2.481 Any pointers on how to deal with the error would be greatly appreciated.ThanksSavitha [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.