ggbarweight {ggsurvey}R 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")

[Package ggsurvey version 1.0.0 Index]