[R] qda problem
Christian Hennig
fm3a004 at math.uni-hamburg.de
Mon Jan 19 17:16:16 CET 2004
Hi,
the following strange error appears when I use qda:
> qda1 <- qda(as.data.frame(mfilters[cvtrain,]),as.factor(traingroups))
Error: function is not a closure
That's also strange:
> qda1 <- qda(mfilters[cvtrain,],as.factor(traingroups))
Error in qda.default(mfilters[cvtrain, ], as.factor(traingroups)) :
length of dimnames must match that of dims
Some backgroud:
> str(mfilters[cvtrain,])
num [1:12500, 1:12] -0.426 0.937 -1.610 -2.099 0.749 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:12500] "1" "2" "8" "9" ...
..$ : NULL
> str(as.factor(traingroups))
Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 1 1 1 1 ...
- attr(*, "names")= chr [1:12500] "1" "2" "8" "9" ...
> str(as.data.frame(mfilters[cvtrain,]))
`data.frame': 12500 obs. of 12 variables:
$ V1 : num -0.426 0.937 -1.610 -2.099 0.749 ...
$ V2 : num 0.7970 -1.9004 0.0443 -1.2074 0.4095 ...
$ V3 : num -0.303 -0.636 -0.806 0.639 0.363 ...
$ V4 : num 0.130 -0.096 -0.644 0.723 0.576 ...
$ V5 : num -0.2942 1.4951 -0.0098 0.3253 0.3881 ...
$ V6 : num -0.2943 -0.6561 -0.0863 -0.0849 -0.5070 ...
$ V7 : num 0.512 -0.618 -0.244 0.392 0.346 ...
$ V8 : num -0.171 0.677 0.117 -0.113 0.669 ...
$ V9 : num 0.2289 -0.3934 0.1051 0.1545 -0.0446 ...
$ V10: num 0.0188 0.5614 -0.2271 0.0340 0.2207 ...
$ V11: num -0.152 0.631 0.447 0.696 0.458 ...
$ V12: num 0.6139 -0.9379 -1.1784 0.0802 -0.6625 ...
...looks proper to me and works without problems with svm...
Even stranger is the fact that my .R file suggests that the first command
qda1 <- qda(as.data.frame(mfilters[cvtrain,]),as.factor(traingroups))
worked in December for the same data (apart from random sampling of
cvtrain/traingroups, but I tried more than one version), and
even under the same version of R (1.8.0).
Can anybody tell me what goes wrong now?
Best,
Christian
***********************************************************************
Christian Hennig
Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
hennig at math.uni-hamburg.de, http://www.math.uni-hamburg.de/home/hennig/
#######################################################################
ich empfehle www.boag-online.de
More information about the R-help
mailing list