Calculates the arithmetic mean after excluding missing values.
A fast, unsafe alternative to base::mean(x, na.rm = TRUE) for numeric vectors.
Arguments
- x
(numeric)
The numeric vector used to calculate the mean.
Examples
#----------------------------------------------------------------------------
# fmean() example
#----------------------------------------------------------------------------
library(bkbase)
fmean(1:3)
#> [1] 2
fmean(c(1:3, NA))
#> [1] 2
fmean(NA)
#> [1] NaN
fmean(numeric(0))
#> [1] NaN