powered by
wtd.barplot is a wrapper around barplot that creates barplots of counts or proportions using weights. Note that for now this only works in the special case of a single weighted variable. Formulas will be added later.
wtd.barplot
wtd.barplot(x, weight = NULL, percent = FALSE, horiz = FALSE, ...)
A barplot is drawn. No value is returned.
Categorical variable (factor or character).
Optional numeric vector of weights.
If TRUE, display percentages instead of raw counts.
TRUE
If TRUE, draw bars horizontally.
Additional arguments passed to barplot.
barplot
Josh Pasek
barplot, table
table
x <- sample(c("Yes", "No"), 100, replace = TRUE) w <- runif(100, 0.5, 2) wtd.barplot(x, weight = w)
Run the code above in your browser using DataLab