View source: R/weighted_mean.R
| weighted_mean | R Documentation | 
Weighted total and mean (Horvitz-Thompson and Hajek estimators)
weighted_mean(x, w, na.rm = FALSE)
weighted_total(x, w, na.rm = FALSE)
| x | 
 | 
| w | 
 | 
| na.rm | 
 | 
weighted_total and weighted_mean compute, respectively,
the Horvitz-Thompson estimator of the population total and the Hajek
estimator of the population mean.
Estimated population mean or total
Overview (of all implemented functions)
head(workplace)
# Horvitz-Thompson estimator of the total
weighted_total(workplace$employment, workplace$weight)
# Hajek estimator of the mean
weighted_mean(workplace$employment, workplace$weight)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.