[Rd] colSums etc. documentation (PR#2545)
   
    David Brahm
     
    brahm@alum.mit.edu
       
    Thu Feb 13 15:45:05 2003
    
    
  
Bert Gunter <bert_gunter@merck.com> wrote:
> > z
>      [,1] [,2]
> [1,]    1   NA
> [2,]    2   NA
> [3,]    3   NA
>
> > colSums(z,na.rm=T)
> [1] 6 0
Certainly correct (the empty set has sum 0 and product 1) and consistent with
other functions.  But you are not the first to mention being surprised by this!
A little more documentation might be helpful, how about:
  If na.rm=TRUE and there are no non-missing values in a range to be summed
  over, the resulting component of the output is 0, consistent with apply().
It seems to me that the na.rm=FALSE case obviously produces `NA', so there's no
need to document this explicitly.
-- 
                              -- David Brahm (brahm@alum.mit.edu)