From klaus.hermann at metagen.de  Tue Apr  1 16:24:45 2003
From: klaus.hermann at metagen.de (klaus.hermann@metagen.de)
Date: Tue Apr  1 15:25:03 2003
Subject: [Rd] computation with vectors of length 0 (PR#2716)
Message-ID: <200304011324.h31DOjn9029959@pubhealth.ku.dk>

Full_Name: Klaus Hermann
Version: 1.5.0
OS: SUNRAY - Unix
Submission from: (NULL) (213.61.59.254)


if we produce a numeric vector of length 0 and want compute the sum over its
elements
the sum function returns 0 - this is obviously misleading. Better would be to
return
NA  and give a corresponding warning.
There should be a unified strategy to handle vectors of length 0.
For example the functions sum, mean, sd handle such vectors in a different way

example:

classfreq <- c(3,3,3,3);
classfreq <- classfreq[classfreq != 3];

sum(classfreq);
mean(classfreq);
sd(classfreq);


[Rd] computation with vectors of length 0 (PR#2716)
klaus.hermann@metagen.de