[R] SVM error

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Jun 4 14:29:11 CEST 2015



On 04.06.2015 08:06, Pijush Das wrote:
> 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.

Make that Tstatus eitehr a factor (which I believe you want to) or also 
numeric.

Best,
Uwe Ligges



>
>
>> 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
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>



More information about the R-help mailing list