agg.wtd.var: Aggregated Weighted Variance

View source: R/agg.wtd.var.R

agg.wtd.varR Documentation

Aggregated Weighted Variance

Description

Splits the data into subsets (according to the levels of a factor) and computes the weighted variance for each

Usage

agg.wtd.var(x, by, weights = NULL, na.rm = FALSE)

Arguments

x

numeric vector or data frame of numeric vectors

by

factor used to split the data

weights

numeric vector of weights. If NULL (default), uniform weights (i.e. all equal to 1) are used.

na.rm

logical, indicating whether NA values should be silently removed before the computation proceeds. Default is FALSE.

Value

a data frame

Author(s)

Nicolas Robette

See Also

agg.wtd.mean

Examples

data(Movies)
agg.wtd.var(Movies[,c("Critics", "BoxOffice")], by = Movies$Country)

descriptio documentation built on Sept. 9, 2025, 5:51 p.m.