[Rd] rowsum() may return a vector instead of a matrix (PR#3737)

David Brahm brahm at alum.mit.edu
Wed Aug 13 10:38:50 MEST 2003


I wrote:
> If all rows are in the same "group", rowsum() returns a vector instead of a
> (1xN) matrix, contrary to documentation:

Thomas Lumley <tlumley at u.washington.edu> replied:
> Is there a strong preference for changing the function vs changing the
> documentation?

I could live with it either way, but I will point out that the "Examples"
section implies an equivalence between:
  R> xsum <- rowsum(x, group)
and
  R> xsum2 <- tapply(x, list(group[row(x)], col(x)), sum)
  R> xsum3 <- aggregate(x, list(group), sum)
which is broken by this new behavior; xsum2 and xsum3 are (1xN) matrices.
-- 
                              -- David Brahm (brahm at alum.mit.edu)



More information about the R-devel mailing list