>>>>> CALUM POLWART >>>>> on Fri, 13 Dec 2024 08:56:15 +0000 writes:
> I've not checked the code, but I think that result would > happen if mean uses something like > if (na.rm == TRUE) { # do something to remove the NA's } > And as uses something like > If (na.rm != FALSE) { # do something to remove the NA's } > Or perhaps ever na.rm == T Hey, "be careful you are insulting" (;-) R core code would *never* contain stupid silly code such as <logical> == TRUE > fortunes :: fortune("TRUE.*TRUE", fixed=FALSE) Ted Harding: But you can also do these with 'any' and 'all', e.g. any(v==TRUE). Thomas Lumley: or any( (v==TRUE)==TRUE), or any( ((v==TRUE)==TRUE)==TRUE)... Or, perhaps, any(v). Lewis Carroll wrote a nice piece on this theme. -- Ted Harding and Thomas Lumley (about implementing an 'or' of a logical vector) R-help (August 2004) It uses if(isTRUE(na.rm)) and yes, people using T for TRUE are "selber tschuld" (Swiss German for "your fault!") Martin > If you ever see posts from Bert on here with T and F, he > is hard core thorough and uses full words for exactly this > reason, someone can reassign F as True if they want and > your code will melt! > On Fri, 13 Dec 2024, 08:31 Ivo Welch, > <ivo.we...@gmail.com> wrote: >> Is the following a strange behavior for `mean` vs. `sd` ? >> >> ``` $ R --vanilla. ## 4.4.2 > x=c(NA,1,2,3) > c( >> mean(x,na.rm=T), sd(x,na.rm=T) ) [1] 2 1 > T=20 ## bad >> idea for a parameter. T is also used for TRUE > c( >> mean(x,na.rm=T), sd(x,na.rm=T) ) [1] NA 1 >> > >> ``` >> >> This one was a baffler for me to track down for a few >> hours... >> >> ______________________________________________ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and >> more, see https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> https://www.R-project.org/posting-guide.html and provide >> commented, minimal, self-contained, reproducible code. >> > [[alternative HTML version deleted]] > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and > more, see https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > https://www.R-project.org/posting-guide.html and provide > commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.