[R] rowsum dimnames

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Sep 13 21:40:05 CEST 2001


David Brahm  <a215020 at agate.fmr.com> writes:

> 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!

Probably a bug. 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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