Dear r-helpers, I am getting a mismatch error between two variables: svp <- ksvm(x, y, type="nu-svc") Error in .local(x, ...) : x and y don't match. and I suspect that it might be due to missing index in the y variable which I defined as: y <- (LVvar[,1]) I tried various methods to make the y assignment in the same format as x, which is a dataframe x <- (LVvar[,-1]) and looks like x rCoordCap rKnowGrow rGoalcom rSupport rOpcomm rT2Cadap 1 4.979167 4.500000 5.812500 6.145833 5.979167 5.031250 ... but I still get y without the indexes as a vector: y [1] -1.00000000 -6.91193182 -1.00000000 0.74431818 -6.91193182 Why are the results different for x and y, even though the assignment is the same except I exclude the columns for y? Cheers, Chaehan [[alternative HTML version deleted]]
Please provide what LVvar is. At least provide str(LVvar), or preferably a 'dput' of the object. PLEASE do read the posting guide http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code. On Tue, Mar 16, 2010 at 6:03 PM, Chaehan So <chaehan.so@gmail.com> wrote:> Dear r-helpers, > > I am getting a mismatch error between two variables: > > svp <- ksvm(x, y, type="nu-svc") > Error in .local(x, ...) : x and y don't match. > > and I suspect that it might be due to missing index in the y variable which > I defined as: > > y <- (LVvar[,1]) > > I tried various methods to make the y assignment in the same format as x, > which is a dataframe > x <- (LVvar[,-1]) > > and looks like > x > rCoordCap rKnowGrow rGoalcom rSupport rOpcomm rT2Cadap > 1 4.979167 4.500000 5.812500 6.145833 5.979167 5.031250 > ... > > but I still get y without the indexes as a vector: > y > [1] -1.00000000 -6.91193182 -1.00000000 0.74431818 -6.91193182 > > > Why are the results different for x and y, even though the assignment is > the > same > except I exclude the columns for y? > > Cheers, > Chaehan > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]]
Hi r-help-bounces at r-project.org napsal dne 17.03.2010 00:03:21:> Dear r-helpers, > > I am getting a mismatch error between two variables: > > svp <- ksvm(x, y, type="nu-svc") > Error in .local(x, ...) : x and y don't match. > > and I suspect that it might be due to missing index in the y variablewhich Why suspect? It is probably better to read the docs. Try ?ksvm and see how x or y shall be defined. Besides why do you expect everybody knows what ksvm is I get> ??ksvmNo help files found with alias or concept or title matching ?ksvm? using regular expression matching. therefore I the function is not a part of my installed packages.> I defined as: > > y <- (LVvar[,1]) > > I tried various methods to make the y assignment in the same format asx,> which is a dataframe > x <- (LVvar[,-1]) > > and looks like > x > rCoordCap rKnowGrow rGoalcom rSupport rOpcomm rT2Cadap > 1 4.979167 4.500000 5.812500 6.145833 5.979167 5.031250 > ... > > but I still get y without the indexes as a vector: > y > [1] -1.00000000 -6.91193182 -1.00000000 0.74431818 -6.91193182 > > > Why are the results different for x and y, even though the assignment isthe> same > except I exclude the columns for y?LVvar is probably data frame. So x is data frame too but y lost dimension so it is a vector. Help page for subsetting is a bit complicated as it has to cover various object types. ?"[" Basically if you want to keep dimensions = you has to use drop=FALSE option in subsetting. Default is FALSE so whenever result is only one column of data frame it is coerced to vector. drop: logical. If ?TRUE? the result is coerced to the lowest possible dimension. The default is to drop if only one column is left, but *not* to drop if only one row is left. Regards Petr> > Cheers, > Chaehan > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.