On Mon, 8 Jun 2015, Christian Brandstätter wrote:

Dear list,

I found an odd behavior of the mean function; it is allowed to do something that you probably shouldn't: If you calculate mean() of a sequence of numbers (without declaring them as vector), mean() then just computes mean() of the first element. Is there a reason why there is no warning, like in sd for example?

mean() - unlike sd() - is a generic function that has a '...' argument that is passed on to its methods. The default method which is called in your example also has a '...' argument (because the generic has it) but doesn't use it.

Example code:
mean(1,2,3,4)
sd(1,2,3,4)

Best regards
Christian

______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
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.

______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
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