rowsum() may return a vector instead of a matrix (PR#3737)
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@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@alum.mit.edu)