sum weighted on the number of non-missing values
Methods that estimates a sum weighted by the number of non-missing values
## S3 method for class 'n' sum(x,n = 1, ...)
x |
A vector of values possibly containing missing values. |
n |
Minimum number of valid values |
... |
extra parameters to sum |
sum(x,n) = mean(x) * length(x) / n.valid(x)
sum.n returns the values of the weighted sum.
Charles-Édouard Giguère
sum.n(c(1, 2, NA, NA), n = 2) ### [1] 6 sum.n(c(1, NA, NA, NA), n = 2) ### [1] NA
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.