sum.n: sum weighted on the number of non-missing values

sum.nR Documentation

sum weighted on the number of non-missing values

Description

Methods that estimates a sum weighted by the number of non-missing values

Usage

 ## S3 method for class 'n'
sum(x,n = 1, ...) 

Arguments

x

A vector of values possibly containing missing values.

n

Minimum number of valid values

...

extra parameters to sum

Details

sum(x,n) = mean(x) * length(x) / n.valid(x)

Value

sum.n returns the values of the weighted sum.

Author(s)

Charles-Édouard Giguère

Examples

sum.n(c(1, 2, NA, NA), n = 2)
### [1] 6
sum.n(c(1, NA, NA, NA), n = 2)
### [1] NA

CUFF documentation built on March 31, 2023, 6:46 p.m.

Related to sum.n in CUFF...