[R] Does anyone.... worth a warning?!? No warning at all
Rolf Turner
r.turner at auckland.ac.nz
Mon Aug 20 21:55:44 CEST 2007
On 20/08/2007, at 9:54 PM, Tom Willems wrote:
> dear Mathew
>
> mean is a Generic function
>
> mean(x...)
>
> in wich x is a data object, like a data frame a list a numeric
> vector...
>
> so in your example it only reads the first character and then
> reports it.
>
> try x = c(1,1,2)
> mean(x)
I think you've completely missed the point. I'm sure Mathew now
understands the syntax
of the mean function. His point was that it would be very easy for
someone to use this
function incorrectly --- and he indicated very clearly *why*, by
giving an example using max().
If mean() could be made safer to use by incorporating a warning,
without unduly adding to
overheads, then it would seem sensible to incorporate such a
warning. Or to change the
mean() function so that mean(1,2,3) returns ``2'' --- just as max
(1,2,3) returns ``3'' --- as
Mathew *initially* (and quite reasonably) expected it to do.
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confidenti...{{dropped}}
More information about the R-help
mailing list