[R] Mean error message missing

Christian Brandstätter bran.chri at gmail.com
Mon Jun 8 09:20:57 CEST 2015


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?

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

Best regards
Christian



More information about the R-help mailing list