[R] differing behavior of mean(), median() and sd() with na.rm
c@l@ndr@ @ending from rgzm@de
Wed Aug 22 16:33:53 CEST 2018
I have just noticed that when input is only NA with na.rm=TRUE, mean()
results in NaN, whereas median() and sd() produce NA. Shouldn't it all
be the same? I think NA makes more sense than NaN in that case.
x <- c(NA, NA, NA) mean(x, na.rm=TRUE)  NaN median(x, na.rm=TRUE) 
NAsd(x, na.rm=TRUE)  NA
Thanks for any feedback.
Dr. Ivan Calandra
TraCEr, laboratory for Traceology and Controlled Experiments
MONREPOS Archaeological Research Centre and
Museum for Human Behavioural Evolution
56567 Neuwied, Germany
+49 (0) 2631 9772-243
More information about the R-help