# NOT RUN {
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")
# }
Run the code above in your browser using DataLab