Hello,
I not have attached in this e-mail the zipped 
list of matrices I am using because it has 1 meg 
once zipped and anyway we cannot send attached 
files on r-help mailling list.
First, after running the code that is written 
bellow, I realized that the printout of dudi.pca 
gives me for both of my matrices
$cw length that are unequal to either respective $rank or $eig lengths.
Is that normal, if not how can I solve it, or get 
around it?   (discrimin() seems to have an issue 
about that)
Secondly, it does not matter which matrices I am 
treating first, but once the second is pasted on 
the second run of my function best, discrimin 
crashes.
The weared thing about this is, that if I perform 
the same operations directly without making a 
function both matrices can be analysed by 
discrimin.
Is it my function that is wrong or the something within the discrimin code!
Here is my code:
load("~/matrix2.RData")
best<-function(liste=alt.transf,nombre=99){
	x<-liste[[nombre]]
	library(ade4)
	p<-99
	xx<-cov(x[,-(1:3)])
	a<-eigen(xx,only.values=T)
	poids<-cumsum(a$values/sum(a$values))
	nombre<-min(which(poids>=(p/100)),na.rm=T)
	acp<-dudi.pca(x[,-(1:3)],scale=T,scannf=F,nf=nombre) #if ve or vt
	print(acp)
	d<-discrimin(acp, as.factor(x[,1]),scan=F,nf=4)
  	return(d)
  }
  b<-best(k,1)
#look at the print out ...
....
$rank: 166
eigen values: 86.02 17.09 12.76 8.727 8.338 ...
   vector length mode    content
1 $cw    167    numeric column weights
2 $lw    475    numeric row weights
3 $eig   166    numeric eigen values
...
#now try
  b<-best(k,2)
#look at the print out ...
....
$rank: 218
eigen values: 104.7 28.94 14.56 10.62 7.793 ...
   vector length mode    content
1 $cw    219    numeric column weights
2 $lw    507    numeric row weights
3 $eig   218    numeric eigen values
...
Error in tapply(dudi$lw, fac, sum) : arguments must have same length
Any suggestions would be really helpful.  I got ton's a matrices to analyse
Thanks a lot!
-- 
  S??bastien Durand
Ma??trise en biologie
Universit?? de Montr??al
(514) 343-6864
Universit?? du Qu??bec ?? Montr??al
(514) 987-3000 (1572#)
Martin Maechler
2004-Aug-02  08:04 UTC
[R] Not attaching zip files to postings.. {was "dudi.pca behaviour..."}
>>>>> "Sebastien" == Sebastien Durand <sebastien.durand at umontreal.ca> >>>>> on Sat, 31 Jul 2004 16:57:07 -0400 writes:Sebastien> Hello, Sebastien> I not have attached in this e-mail the zipped Sebastien> list of matrices I am using because it has 1 meg Sebastien> once zipped and anyway we cannot send attached Sebastien> files on r-help mailling list. yes, some (few) you can, but definitely not zip files -- AFAIK nowadays most viruses come as *.zip ... The posting guide (below) tells you what to do instead of attaching them. Regards, Martin