[R] Weird Behavior of mean

ivo welch |vo@we|ch @end|ng |rom uc|@@edu
Fri Dec 13 20:21:13 CET 2024


isn't this still a little R buglet?  I have overwritten T (even if my
schuld [franconian], it is not that uncommon an error, because T is also a
common abbreviation for the end of a time series; namespace pollution in R
can be quite annoying, even though I understand that it is convenient in
interactive mode).  Nevertheless, I am passing into mean() a positive
number for na.rm, and by definition, a positive number still means TRUE.
 besides, sd() and mean() should probably treat this similarly, anyway.  I
do see the argument that functions cannot be proof against redefinitions of
all sorts of objects that they can use.    more philosophically, some
variables should not be overwritable, or at least trigger a warning.

As Dante wrote, Abandon all hope ye who enter R.

--
Ivo Welch (ivo.welch using ucla.edu)

	[[alternative HTML version deleted]]



More information about the R-help mailing list