mean_na: Return the mean

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Return the mean of 'x'. If no observations, return 'NA'. This is a workaround for the fact that in data.table, ':= mean(x, na.rm = TRUE)' will return 'NaN' where there are no observations

Usage

1

Arguments

x

data potentially with non-finite values

Value

Mean of the input

Examples

1
mean_na(c(1,2,3,7,9,NA)) ## 4.4

dateutils documentation built on Nov. 10, 2021, 5:09 p.m.