| weighted_pct | R Documentation | 
This is a fast, dependency-free weighted proportion table for 1D variables.
weighted_pct(x, weights)
| x | A vector of any type | 
| weights | A numeric vector of weights, equal in length to  | 
A named vector with weighted proportions.
# Setup examle data
x <- c(rep(1, 5), rep(2, 5))
weights <- c(rep(1, 5), rep(2, 5))
# Unweighted proportions: 0.5 / 0.5
prop.table(table(x))
# Weighted proportions: 0.33 / 0.66
weighted_pct(x, weights)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.