[R] Problem with svm.tune

Anne Dwyer anne.p.dwyer at gmail.com
Sun Jun 23 23:15:10 CEST 2013


I am trying to learn to tune a svm model in R.

I'm using the sonar data set used by David Mease in his Google Tech
Talk video. I downloaded the data from his site. There are 130
observations in the training set. I am able to run a svm model. But
when I try to run this command:


tune_svm <-tune.svm(y~., data=x, gamma=10^(-6:-3), cost=10^(1:2))

where y is the categorical response vector for the training set and x
is the training data for x, I get the following error:

Error in model.frame.default(formula, data) : variable lengths differ
(found for 'V1')

I've doublechecked that all the data is the same length. I cleared the
workspace to make sure that I didn't have any other data labeled as x
or y.

Can someone tell me what I am doing wrong here?

Thanks.



More information about the R-help mailing list