[R] rowsum dimnames

David Brahm a215020 at agate.fmr.com
Thu Sep 13 21:24:11 CEST 2001


Hi,

The result of rowsum() in R doesn't have the dimnames I'd expect, e.g.:

> rowsum(matrix(1:12, 3,4), c("Y","X","Y"))
    [,1] [,2] [,3] [,4]
  1    2    5    8   11
  2    4   10   16   22

whereas S-Plus gives the more useful result:
    [,1] [,2] [,3] [,4] 
  X    2    5    8   11
  Y    4   10   16   22

This is because R's rowsum() code gives the first dimnames as "ugroup", which
is a factor, rather than "as.character(ugroup)".  Is this a bug or a feature?

I'm using R 1.3.0 on Solaris 2.6.  Help says rowsum's author is Terry Therneau.
Thanks!
			-- David Brahm (a215020 at agate.fmr.com)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list