Retrieve the levels and labels of a variable from an edsurvey.data.frame
, a light.edsurvey.data.frame
, or an edsurvey.data.frame.list
.
Arguments
- varnames
a vector of character strings to search for in the database connection object (
data
)- data
an
edsurvey.data.frame
, alight.edsurvey.data.frame
, or anedsurvey.data.frame.list
- 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
Examples
if (FALSE) { # \dontrun{
# 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)
} # }