ggbarweight_svy {ggsurvey} | R Documentation |
Bar Chart from svydesign objects
Description
In ggsurvey you specify both the plotting variables and weights in plain text with no quotes.
Usage
ggbarweight_svy(surveyobj, x, fill = NULL)
Arguments
surveyobj |
svydesign |
x |
variable to plot |
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)
data(api)
dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)
ggbarweight_svy(dstrat, stype)+ylab("Proportion")
ggbarweight_svy(dstrat, stype, fill = TRUE)
data(nhanes)
design <- svydesign(id=~SDMVPSU, strata=~SDMVSTRA, weights=~WTMEC2YR, nest=TRUE,data=nhanes)
ggbarweight_svy(design, agecat)+ylab("Proportion")
ggbarweight_svy(design, agecat, fill = TRUE)+ylab("Proportion")
[Package ggsurvey version 1.0.0 Index]