weighted_mean <- function(x, w, na.rm = T) {
if(na.rm) {
omitted_na <- na.omit(data.frame(x, w))
return(weighted.mean(omitted_na$x, omitted_na$w))
}
weighted.mean(x, w)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.