levelsSDF | R Documentation |
Retrieve the levels and labels of a variable from an edsurvey.data.frame
, a light.edsurvey.data.frame
, or an edsurvey.data.frame.list
.
levelsSDF(varnames, data, showOmitted = TRUE, showN = TRUE)
varnames |
a vector of character strings to search for in the database connection object ( |
data |
an |
showOmitted |
a Boolean indicating if omitted levels should be shown |
showN |
a Boolean indicating if (unweighted) n-sizes should be shown for each response level |
Michael Lee and Paul Bailey
## Not run:
# read in the example data (generated, not real student data)
sdf <- readNAEP(path=system.file("extdata/data", "M36NT2PM.dat", package = "NAEPprimer"))
# search variables in the sdf
levelsSDF(varnames="pared", data=sdf)
# search multiple variables
levelsSDF(varnames=c("pared","ell3"), data=sdf)
# search multiple variables in a light.edsurvey.data.frame with recodes
df2 <- getData(data=sdf, varnames=c("dsex", "t088301"),
recode=list(t088301=list(from=c("Yes, available","Yes, I have access"),
to=c("Yes")),
t088301=list(from=c("No, have no access"),
to=c("No"))),
addAttributes=TRUE)
levelsSDF(varnames=c("dsex","t088301"), data=df2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.