Learn R Programming

simsem (version 0.2-0)

weightedMean: Calculate the weighted mean of a variable

Description

Calculate the weighted mean of a variable

Usage

weightedMean(x, weight=NULL)

Arguments

x
A target vector to be averaged
weight
The weight of each element

Value

  • A weighted mean value

Examples

Run this code
# This function is not public

# weightedMean(1:5, c(1,1,1,1,2))

Run the code above in your browser using DataLab