cmip5.weighted.mean: Alternative weighted mean

Description Usage Arguments Details Value See Also

View source: R/RCMIP5.R

Description

Alternative weighted mean

Usage

1
cmip5.weighted.mean(x, w = rep(1, length(x)), na.rm = TRUE)

Arguments

x

vector of data

w

vector of weights

na.rm

Remove NAs in both data and weights?

Details

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.

Value

Weighted mean of x, using weights d.

See Also

weighted.mean


RCMIP5 documentation built on May 1, 2019, 6:28 p.m.