amy_4_5_84 at hotmail.com
Tue Feb 23 10:40:30 CET 2010
Thank you so much for your reply.
I’m attaching the dataset and this is my code:
mydata <- as.matrix(read.delim("iris.txt"))
train.x <- mydata[,-1]
train.y <- mydata[,1]
mymodel <- svm(train.x, train.y, cross=3, type="C-classification")
Could you please try it and try it with the attached dataset? I tried it with different datasets and the problem remains.
> Date: Mon, 22 Feb 2010 10:02:31 -0500
> Subject: Re: [R] svm
> From: mailinglist.honeypot at gmail.com
> To: amy_4_5_84 at hotmail.com
> CC: r-help at r-project.org
> Hi Amy,
> On Sat, Feb 20, 2010 at 9:29 PM, Amy Hessen <amy_4_5_84 at hotmail.com> wrote:
> > Hi ,
> > Could you please help me in this question:?
> > After trying this code:
> > library(e1071)
> > mydata <- as.matrix(read.delim("iris.txt"))
> > train.x <- mydata[,-1]
> > train.y <- mydata[,1]
> > mymodel <- svm(train.x, train.y, cross=3, type="C-classification")
> > I receive this error:
> > Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric
> > I put the class label in the first column.
> I think you would be able to find out where many of your problems lie
> if you try to provide a reproducible example we can use to test:
> meaning, something I can just copy from your email and paste into my R
> workspace that would reproduce your problem.
> The error is telling you that something is expecting "x" to be
> numeric, and it's not. So the question is, what isn't "numeric"? I
> guess the answer must be in one of the two arguments you supply to the
> svm function, so can you please check to see what "type" of arguments
> you are passing into your function?
> You can do that by running these R commands?
> R> is(mydata)
> R> is(train.x)
> R> is(train.y)
> What do you get from that?
> Steve Lianoglou
> Graduate Student: Computational Systems Biology
> | Memorial Sloan-Kettering Cancer Center
> | Weill Medical College of Cornell University
> Contact Info: http://cbio.mskcc.org/~lianos/contact
View photos of singles in your area! Browse profiles for FREE
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the R-help