From cbeleites at units.it  Mon Feb 14 22:03:24 2011
From: cbeleites at units.it (Claudia Beleites)
Date: Mon, 14 Feb 2011 22:03:24 +0100
Subject: [Rd] drop argument for apply, rowSums, etc.
Message-ID: <4D59989C.7000703@units.it>

Dear list, dear Henrik,

I find myself often reconstructing matrices from the result of rowSum (matrix) 
etc. I therefore propose a new argument, drop, for these functions:

drop = TRUE (default) is the current behaviour. With
drop = FALSE length (dim (x)) and dimnames are preserved and the affected 
dimensions are set to 1 (or whatever teh result length of the applied function is)

I modified the base functions in colSums.R accordingly, and provide the 
respective methods (I did not yet have the time to look into apply.R).

I'm wondering whether these changes are of sufficient interest to the R public 
that these methods should have a more obvious "home" than a spectroscopy 
package. As I learned this morning of package matrixStats: Henrik, would you 
like to include these modified functions?

Anyways, the code is in the attached file, so if someone needs the funcionality, 
he can find it here.

Claudia












-- 
Claudia Beleites
Dipartimento dei Materiali e delle Risorse Naturali
Universit? degli Studi di Trieste
Via Alfonso Valerio 6/a
I-34127 Trieste

phone: +39 0 40 5 58-37 68
email: cbeleites at units.it
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: colSums.R
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20110214/d4641f70/attachment.pl>


[Rd] drop argument for apply, rowSums, etc.
Claudia Beleites