safe_mean {tabbycat} | R Documentation |
Calculate mean
but return NA rather than NaN when values are missing
Description
This function is a drop-in replacement for mean
, which is used in
cat_summarise
. It returns NA rather than NaN when all values are NA.
Usage
safe_mean(x, na.rm = FALSE)
Arguments
x |
A numerical vector. |
na.rm |
A boolean indicating whether to remove NAs. |
Value
The mean of x
or NA when values are missing.
[Package tabbycat version 0.18.0 Index]