Hi,

I was *very* surprised by this little trick for new players: mean() only 
considers its first argument!

 > mean(1,1,2)
[1] 1
 > mean(2,1,1)
[1] 2


I found this very different behaviour to max():

 > max(1,1,2)
[1] 2
 > max(2,1,1)
[1] 2



Perhaps this is the wrong list to ask, but does anyone else think this a 
little on the interesting side?  Is it not possible to detect a first 
argument of length one in the presence of other un-named arguments and 
at least produce a warning?


Cheers,


Matthew

______________________________________________
R-help@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.

Reply via email to