[R] problem with aggregate

Philippe Hupé Philippe.Hupe at curie.fr
Fri May 14 18:37:37 CEST 2004


Hi,

I am trying to do the following  aggregation :


 data <- data.frame(a=rep(2,10),b=rep("a",10))
 aggregate(data$a, by=list(a1=data$a, b1=data$b), NROW)

but I have the following error message


Error in "names<-.default"(`*tmp*`, value = c(names(by), names(x))) :
        names attribute [3] must be the same length as the vector [2]
In addition: Warning message:
row names were found from a short variable and have been discarded in: 
data.frame(w, lapply(y, unlist, use.names = FALSE))

It works if there are more than 2 modalities in data$b. I can test if 
there is only one modality of course but there is no reason for the 
function not working in this particular case.


I use R 1.9.0 under Solaris

-- 
Philippe Hupé
UMR 144 - Service Bioinformatique
Institut Curie
Laboratoire de Transfert (4ème étage)
26 rue d'Ulm
75005 Paris - France
 	
Email :  Philippe.Hupe at curie.fr
Tél :	 +33 (0)1 44 32 42 75
Fax :  	 +33 (0)1 42 34 65 28




More information about the R-help mailing list