safe_mean | R Documentation |
mean
but return NA rather than NaN when values are missingThis 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.
safe_mean(x, na.rm = FALSE)
x |
A numerical vector. |
na.rm |
A boolean indicating whether to remove NAs. |
The mean of x
or NA when values are missing.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.