[Rd] rowSums()/colSums() don't preserve the 'integer' storage mode

Herve Pages hpages at fhcrc.org
Thu Jul 17 07:48:00 CEST 2008


Hi,

Wouldn't that make sense to have rowSums()/colSums() to preserve the
storage mode?

m <- matrix(1:15, nrow=5)

 > storage.mode(m)
[1] "integer"

 > storage.mode(sum(m))
[1] "integer"

 > storage.mode(rowSums(m))
[1] "double" <------------------- surprising!

Cheers,
H.



More information about the R-devel mailing list