Skip to content
Prev 39177 / 63421 Next

drop argument for apply, rowSums, etc.

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