| ggbarweight | R Documentation |
In ggsurvey you specify both the plotting variables and weights in plain text with no quotes.
ggbarweight(df, x, weights, fill = NULL)
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 |
ggplot object
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.