Description Usage Arguments Details Value See Also
Alternative weighted mean
1 | cmip5.weighted.mean(x, w = rep(1, length(x)), na.rm = TRUE)
|
x |
vector of data |
w |
vector of weights |
na.rm |
Remove NAs in both data and weights? |
The stats
version of weighted.mean doesn't handle weights in a very
useful way. Specifically, it will remove missing x
values, but not missing weights.
A fair number of CMIP5 models have NA
values in their grid areas, so this will
quickly cause problems. This function removes (if na.rm=TRUE
) missing observations
and weights before computing the weighted mean.
Weighted mean of x
, using weights d
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.