[R] Does anyone else think this might be worth a warning?!?

Matthew Walker m.g.walker at massey.ac.nz
Sun Aug 19 08:40:23 CEST 2007


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



More information about the R-help mailing list