Nothing
### -*- Coding: utf-8 -*- ###
### Analyste: Charles-Édouard Giguère. ###
### Sum that is weighted by the number of non missing values.
### if less value than n are missing it returns NA.
sum.n <- function (x, n = 1, ...){
n.val <- sum(!is.na(x))
l.val <- length(x)
if (n.val >= n){
return(mean(x, na.rm = TRUE, ...) * l.val)
}
else{
return(NA)
}
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.