Skip to content
Prev 6254 / 63421 Next

1.4.0: mean/sum of logicals

On 5 Oct 2001, Peter Dalgaard BSA wrote:

            
Back-compatibility.  In data frames logicals used to get coerced to
two-level factors, not to numerics, and then mean would fail for them.
If a logical is an experimental factor, sums make sense but means do not.

Here is what I find confusing (1.3.1).
[1] 0.5
Error in Summary.factor(..., na.rm = na.rm) :
        "sum" not meaningful for factors

There 1.4.0 is consistent.

Change it if you like, but do think through all the implications of the
inconsistent treatment of logicals (for which I have not had time as yet).