Screenshots are unhelpful. Please use a reprex
.
As far as the general question of why
recall that R
was invented, and has been extended and maintained, for use by statisticians for statisticians over a period 10 years longer than the existence of Google, beginning with the language S
from Bell Labs in 1988. You've identified the source of the disconnect
median
has an default argument of na.rm = FALSE
because calculations involving NA
evaluate to NA
.
NA + 1
#> [1] NA
NA
is not equivalent to 0
and shouldn't be treated as if it were.