From Torsten.Hothorn@rzmail.uni-erlangen.de  Fri Oct  5 12:20:54 2001
From: Torsten.Hothorn@rzmail.uni-erlangen.de (Torsten Hothorn)
Date: Fri, 5 Oct 2001 13:20:54 +0200 (MEST)
Subject: [Rd] 1.4.0: mean/sum of logicals
Message-ID: <Pine.LNX.4.21.0110051314040.12509-100000@artemis.imbe.med.uni-erlangen.de>


the NEWS file in  1.4.0-devel states: 

o   mean() has `data frame' method applying mean column-by-column.
    When applied to non-numeric data mean() now returns NA rather
    than a confusing error message (for compatibility with S4).


which means: 

R> mean(c(TRUE, FALSE))
[1] NA
Warning message: 
argument is not numeric: returning NA in: mean.default(c(TRUE, FALSE)) 

but: 

R> sum(c(TRUE, FALSE))
[1] 1

?sum states: 

     sum(..., na.rm=FALSE)

Arguments:

     ...: numeric vectors.

and clearly

R> is.numeric(c(TRUE, FALSE))
[1] FALSE


this is confusing, isn't it? I think that `sum' and `mean' should take the
same arguments (and one probably will not allow to sum up logicals) or am
I missing something?

Torsten

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] 1.4.0: mean/sum of logicals
Torsten Hothorn