Learn R Programming

Rrepest (version 1.5.2)

weighted.var: Weighted variance

Description

Computes the weighted variance of a numeric vector.

Usage

weighted.var(x, w, na.rm = TRUE)

Value

Scalar containing the variance

Arguments

x

(numeric vector) Variable of interest for which to compute the variance

w

(numeric vector) Vector with weights

na.rm

(bool) if TRUE: Excludes missing values before computing the variance

Examples

Run this code
data(df_talis18) 

weighted.var(df_talis18$TT3G02, df_talis18$TRWGT1)

Run the code above in your browser using DataLab