This is due to the nasty "gotcha" in the function mean()(not listed on the R trap list , but probably should be): you want mean(c(a,b)), not mean(a,b). From ?mean:
(x,...)
[snip snip snip]
... , .
, , mean(5,10)? mean mean.default, trim :
trim ( 0 0,5) , x . .
" " , trim 0,5 0,5, , mean 50% , , . mean.default, , ...
if (trim >= 0.5)
return(stats::median(x, na.rm = FALSE))
, mean(c(x,<value_greater_than_0.5>)) c(5), 5...