na_mean: Compute mean and handle all NA

Description Usage Arguments Value

Description

When computing the mean of a vector and removing missing values with na.rm = TRUE, this results in NaN if all values were NA. This function handles such occassions by returning NA instead.

Usage

1
na_mean(x, na.rm = TRUE, ...)

Arguments

x

An R object. Currently there are methods for numeric/logical vectors and date, date-time and time interval objects. Complex vectors are allowed for trim = 0, only.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

...

further arguments passed to or from other methods.

Value

Mean of non-missing values or, if all values were missing, NA.


drsimonj/adapter documentation built on May 15, 2019, 2:51 p.m.