Someone forgot drop=FALSE was needed. Fixed in R-patched. BTW, calling an object `data' is not a good idea.
On Fri, 14 May 2004, Philippe Hupé wrote: > 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 > > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html