mean_na {dateutils}R Documentation

Return the mean

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

mean_na(x)

Arguments

x

data potentially with non-finite values

Value

Mean of the input

Examples

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

[Package dateutils version 0.1.5 Index]