wtd.barplot {weights}R Documentation

Weighted barplot

Description

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.

Usage

wtd.barplot(x, weight = NULL, percent = FALSE, horiz = FALSE, ...)

Arguments

x

Categorical variable (factor or character).

weight

Optional numeric vector of weights.

percent

If TRUE, display percentages instead of raw counts.

horiz

If TRUE, draw bars horizontally.

...

Additional arguments passed to barplot.

Value

A barplot is drawn. No value is returned.

Author(s)

Josh Pasek

See Also

barplot, table

Examples

x <- sample(c("Yes", "No"), 100, replace = TRUE)
w <- runif(100, 0.5, 2)
wtd.barplot(x, weight = w)

[Package weights version 1.1.2 Index]