Learn R Programming

rineq (version 0.3.0)

var_wt: Calculates the weighted variance

Description

Calculates the weighted variance

Usage

var_wt(x, wt, na.rm = FALSE)

Value

A numeric vector containing weighted variance of the elements of x

Arguments

x

numeric vector

wt

weights

na.rm

If TRUE, indices where x is NA will be removed

Examples

Run this code
x <- sample(1:10, size = 10, replace = TRUE)
x.weight <- seq(0, 1, length.out = 10)
var_wt(x, wt = x.weight)

Run the code above in your browser using DataLab