| ggbarcrosstabs | R Documentation | 
In ggsurvey you specify both the plotting variables and weights in plain text with no quotes. This function creates a crosstab of x by a second variable y.
ggbarcrosstabs(df, x, y, weights, fill = NULL, labeller = NULL)
df | 
 data frame of survey  | 
x | 
 variable to bar chart  | 
y | 
 faceting variable  | 
weights | 
 survey weights that sum to sample size  | 
fill | 
 if true the fill of each bar will be a different color corresponding to the level of the factor  | 
labeller | 
 argument to pass onto facet_grid  | 
ggplot object
library(survey)
data(api)
ggbarcrosstabs(apistrat, stype, yr.rnd, pw)+ylab("Proportion")
ggbarcrosstabs(apistrat, stype, yr.rnd, pw, fill = TRUE)+ylab("Proportion")
data(nhanes)
ggbarcrosstabs(nhanes, race, agecat, WTMEC2YR)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.