ggbarcrosstabs_svy {ggsurvey} | R Documentation |
Crosstabs for svy.design objects
Description
In ggsurvey you specify both the plotting variables and weights in plain text with no quotes.
Usage
ggbarcrosstabs_svy(surveyobj, x, y, fill = NULL, labeller = NULL)
Arguments
surveyobj |
svy.design obj |
x |
variable for bar chart |
y |
faceting variable (comparison factor) |
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 |
Value
ggplot object
Examples
library(survey)
library(ggplot2)
data(api)
dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)
ggbarcrosstabs_svy(dstrat, stype, yr.rnd)+ylab("Proportion")
ggbarcrosstabs_svy(dstrat, stype, yr.rnd, TRUE)+ylab("Proportion")
data(nhanes)
design <- svydesign(id=~SDMVPSU, strata=~SDMVSTRA, weights=~WTMEC2YR, nest=TRUE,data=nhanes)
ggbarcrosstabs_svy(design, race, agecat)
[Package ggsurvey version 1.0.0 Index]