[R] SVM error

Pijush Das topijush at gmail.com
Thu Jun 4 08:06:20 CEST 2015


Dear Sir,

I have converted the data into numeric as the function read.excel read the
data file as a character (as it was said by David Meyer, maintainer of the
package e1071) and after that run the function svm. Then another error is
found there. The detail description of the code and error is given below.

Please check this code and try to solve the error.


> library(e1071)
> library("openxlsx")
>List <- read.xlsx(file.choose(), sheet = 1,colNames = TRUE,rowNames = TRUE)
>Data <- read.xlsx(file.choose(), sheet=1,colNames = TRUE,rowNames = TRUE)
> status<-Data[1, ]
> View(status)
> FilterData <-Data[rownames(List), ]
> View(FilterData)
> TFData<-matrix( nrow=10, ncol=1630)
> for(i in 1:1630){
+   for(j in 1:10){
+     a<-FilterData[i,j]
+     TFData[j,i]<- as.numeric(a)
+
+   }
+ }
> Tstatus <- t(status)
> x<-TFData
> is.numeric(x)
[1] TRUE
> y<-Tstatus
> model <- svm( x, y)
Error in svm.default(x, y) :
  Need numeric dependent variable for regression.

Please find the attached files, given below.

Thank You



With regards
Pijush


More information about the R-help mailing list