[R] problems with lda , data included, can somebody test with the new version
Nicolaas Busscher
busscher at wiz.uni-kassel.de
Wed Aug 6 12:34:14 CEST 2003
enclosed a simple R script (and a data file, and the output) , with
calls lda similar to the example with the iris data in the
documentation. it is not working and i dont understand the error
message. can anybody help me? i am using R 1.5.1 (2002.06.17) on
debian woody stable.
I would like to avoid updating now, because i want to keep the system
in "stable". can somebody test, if the newer version didnt have this
problem ? thanks
------ data ---------------
"diagonal.moment" "cluster.shade" "histogram.kurtosis" "assignment"
"1" 91.966025 -11402.735755 -0.113658 "5"
"2" 87.216671 -13892.812239 -0.106662 "5"
"3" 94.23765 -12397.68244 -0.110086 "5"
"4" 120.130753 -17229.165583 -0.119237 "5"
"5" 84.952756 -13024.921078 -0.110119 "5"
"6" 97.635587 -11984.989519 -0.103907 "5"
"7" 60.416425 -8641.988229 -0.116222 "5"
"8" 84.79081 -12332.977083 -0.1091 "5"
"9" 78.408806 -11373.916988 -0.112666 "5"
"10" 137.415571 -18491.889203 -0.118939 "5"
"11" -10.156979 -1495.884639 -0.104795 "5"
"12" 92.383809 -11601.060884 -0.11422 "5"
"13" 147.584707 -19084.747951 -0.120416 "6"
"14" 146.609465 -21629.814571 -0.121656 "6"
"15" 143.91174 -19878.044959 -0.118049 "6"
"16" 177.170923 -26024.777287 -0.121526 "6"
"17" 134.00609 -18110.76336 -0.118185 "6"
"18" 138.793062 -18347.029573 -0.121952 "6"
"19" 125.658219 -16204.88335 -0.119324 "6"
"20" 99.369435 -14246.410482 -0.122442 "6"
"21" 154.763888 -21116.0578 -0.120623 "6"
"22" 127.359594 -17490.575516 -0.120079 "6"
"23" 136.568559 -18329.619348 -0.121503 "6"
"24" 127.983753 -16243.10434 -0.121176 "6"
-----
script:
library(MASS)
actaData<-read.table("actaData.dat")
actaData
ass<-actaData$assignment
print(ass)
tass<-table(ass)
print(tass)
#print(attributes(tass))
priodim<-attr(tass,"dim")
prio=c(rep(1,priodim))/priodim
print(prio)
actaData
z<-lda(assignment ~ .,actaData,prior=prio,tol=1.0e-08)
--- end script---
start output:
end output
> print(dim(actaData))
[1] 24 4
>
> ass<-actaData$assignment
> print(ass)
[1] 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6
> tass<-table(ass)
> print(tass)
ass
5 6
12 12
> #print(attributes(tass))
> priodim<-attr(tass,"dim")
> prio=c(rep(1,priodim))/priodim
> print(prio)
[1] 0.5 0.5
>
> actaData
diagonal.moment cluster.shade histogram.kurtosis assignment
1 91.96603 -11402.736 -0.113658 5
2 87.21667 -13892.812 -0.106662 5
3 94.23765 -12397.682 -0.110086 5
4 120.13075 -17229.166 -0.119237 5
5 84.95276 -13024.921 -0.110119 5
6 97.63559 -11984.990 -0.103907 5
7 60.41642 -8641.988 -0.116222 5
8 84.79081 -12332.977 -0.109100 5
9 78.40881 -11373.917 -0.112666 5
10 137.41557 -18491.889 -0.118939 5
11 -10.15698 -1495.885 -0.104795 5
12 92.38381 -11601.061 -0.114220 5
13 147.58471 -19084.748 -0.120416 6
14 146.60947 -21629.815 -0.121656 6
15 143.91174 -19878.045 -0.118049 6
16 177.17092 -26024.777 -0.121526 6
17 134.00609 -18110.763 -0.118185 6
18 138.79306 -18347.030 -0.121952 6
19 125.65822 -16204.883 -0.119324 6
20 99.36943 -14246.410 -0.122442 6
21 154.76389 -21116.058 -0.120623 6
22 127.35959 -17490.576 -0.120079 6
23 136.56856 -18329.619 -0.121503 6
24 127.98375 -16243.104 -0.121176 6
>
> z<-lda(assignment ~ .,actaData,prior=prio,tol=1.0e-08)
Error in scale(group.means, center = xbar, scale = FALSE) :
unused argument(s) (center ...)
Execution halted
#-----------------------------------------
### output from R --version
R 1.5.1 (2002-06-17).
Copyright (C) 2002 R Development Core Team
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the GNU
General Public License. For more information about these matters,
see http://www.gnu.org/copyleft/gpl.html.
-------------------
Dr.Nicolaas Busscher Universität GH Kassel
Nordbahnhofstrasse: 1a, D-37213 Witzenhausen
Phone: 0049-(0)5542-98-1715, Fax: 0049-(0)5542-98-1713
More information about the R-help
mailing list