Please do note that this too is a reading error. The documentation for rowsum() says
group: a vector giving the grouping, with one element per row of 'x'. R has used 'group' as if it were as.vector(group), as it was entitled to do. If you do not want that, give a _vector_ with the property you do want, e.g. as.character(group). You could also call rowsum() with reorder=FALSE and reorder later to your taste. On Thu, 17 Aug 2006, Brahm, David wrote: > On 8/3/2006 10:34 AM, <[EMAIL PROTECTED]> noted that, > starting with R-2.3.0, sort() fails to preserve date classes: > > > dates <- seq(Sys.Date(), len=5, by="1 day") > > dates[order(dates)] > > [1] "2006-08-03" "2006-08-04" "2006-08-05" "2006-08-06" "2006-08-07" > > sort(dates) > > [1] 13363 13364 13365 13366 13367 > > and Duncan Murdoch <[EMAIL PROTECTED]> replied: > > > The problem is that some classes assume a particular ordering for > > values; sort can mess them up. If you know that's not the case, you > > can protect the class yourself: > > cl <- class(dates) > > sorteddates <- sort(dates) > > class(sorteddates) <- cl > > I have to agree with Stephen (and Alex Dannenberg in another post) > that this change is unfortunate for date classes. How do you > reproduce this old behavior (without assuming alphanumeric ordering): > > > x <- matrix(1:12, 4,3) > > group <- Sys.Date() + c(0,1,0,1) > > rowsum(x, group) > [,1] [,2] [,3] > 2006-08-17 4 12 20 > 2006-08-18 6 14 22 > > Under R-2.3.1, the result is now: > [,1] [,2] [,3] > 13377 4 12 20 > 13378 6 14 22 > > Blech! > > -- David Brahm ([EMAIL PROTECTED]) -- 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 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel