if (requireNamespace("survey")) {
library(survey)
data(api)
# Create survey design object
dstrat <- svydesign(id = ~1,strata = ~stype, weights = ~pw, data = apistrat,
fpc=~fpc)
# Print the standard deviation of some variables
svysd(~api00+ell+meals, design = dstrat)
}
Run the code above in your browser using DataLab