[R] svm code, what is wrong here?

Aimin Yan aiminy at iastate.edu
Fri Dec 8 05:09:28 CET 2006


 > install.packages("e1071")
Warning: package 'e1071' is in use and will not be installed
 > library(e1071)
 > library(MASS)
 > p5 <- read.csv("http://www.public.iastate.edu/~aiminy/data/p_5_2.csv")
 > attach(p5)

         The following object(s) are masked from p5 ( position 3 ) :

          Aa As Cur Ms P Y


         The following object(s) are masked from p5 ( position 4 ) :

          Aa As Cur Ms P Y

 > m.svm<-svm(as.factor(Y)~.,data=p5)
 > summary(m.svm)

Call:
svm(formula = as.factor(Y) ~ ., data = p5)


Parameters:
    SVM-Type:  C-classification
  SVM-Kernel:  radial
        cost:  1
       gamma:  0.03846154

Number of Support Vectors:  755

  ( 377 378 )


Number of Classes:  2

Levels:
  0 1



 > plot(m.svm,p5,As~Cur)
Error in scale(newdata[, object$scaled, drop = FALSE], center = 
object$x.scale$"scaled:center",  :
         (subscript) logical subscript too long
 >
 >




More information about the R-help mailing list