ggbarweight: Weighted Univariate Bar Charts

View source: R/barcharts.R

ggbarweightR Documentation

Weighted Univariate Bar Charts

Description

In ggsurvey you specify both the plotting variables and weights in plain text with no quotes.

Usage

ggbarweight(df, x, weights, fill = NULL)

Arguments

df

data frame of survey

x

name of question of interest

weights

survey weights that sums to sample size

fill

if true the fill of each bar will be a different color corresponding to the level of the factor

Value

ggplot object

Examples

library(survey)
#Example with data frame
data(api)
ggbarweight(apistrat, stype, pw)
ggbarweight(apistrat, stype, pw, fill = TRUE)
data(nhanes)
ggbarweight(nhanes, race, WTMEC2YR)+ylab("Proportion")

balexanderstats/ggsurvey documentation built on May 12, 2022, 2:22 p.m.