Herve Pages
2008-Jul-17 05:48 UTC
[Rd] rowSums()/colSums() don't preserve the 'integer' storage mode
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.
Bill.Venables at csiro.au
2008-Jul-17 06:57 UTC
[Rd] rowSums()/colSums() don't preserve the 'integer' storage mode
I don't see the cost of doing so paying off. storage.mode is really only important if you are passing arguments to compiled code. If you are passing to compiled code, you really need to ensure the storage mode is what you think it is, anyway. Bill Venables. -----Original Message----- From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-project.org] On Behalf Of Herve Pages Sent: Thursday, 17 July 2008 3:48 PM To: R-devel at r-project.org Subject: [Rd] rowSums()/colSums() don't preserve the 'integer' storage mode 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. ______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel