Tom Willems
2007-Aug-20 09:54 UTC
[R] Does anyone.... worth a warning?!? No warning at all
Een ingesloten tekst met niet-gespecificeerde tekenset is van het bericht gescrubt ... Naam: niet beschikbaar Url: https://stat.ethz.ch/pipermail/r-help/attachments/20070820/a4fb056c/attachment.pl
Rolf Turner
2007-Aug-20 19:55 UTC
[R] Does anyone.... worth a warning?!? No warning at all
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}}
Mike Meredith
2007-Aug-21 02:45 UTC
[R] Does anyone.... worth a warning?!? No warning at all
It's always seemed to me that 'mean' behaved as expected, and 'max' et al were peculiar. If you passed 2 or more vectors to a function would you really expect it to concatenate them before doing it's proper job? I'd rather expect it to behave like 'pmax' and compare them element by element. Maybe 'max' should generate a warning. Cheers, Mike Tom Willems-2 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) > > kind regards, > Tom > > > Disclaimer: click here > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >-- View this message in context: http://www.nabble.com/Re%3A-Does-anyone....-worth-a-warning-%21--No-warning-at-all-tf4297988.html#a12247316 Sent from the R help mailing list archive at Nabble.com.