Retrieves variable names, variable labels, and value labels for an
edsurvey.data.frame
, a light.edsurvey.data.frame
, or an edsurvey.data.frame.list
.
Arguments
- data
an
edsurvey.data.frame
, alight.edsurvey.data.frame
, or anedsurvey.data.frame.list
- fileFormat
a character string indicating the data source to search for variables. The default
NULL
argument searches all available codebooks in the database connection object.- labelLevels
a logical value; set to
TRUE
to return a snapshot of the label levels in anedsurvey.data.frame
, alight.edsurvey.data.frame
, or anedsurvey.data.frame.list
. When set toFALSE
(the default), label levels are removed.- includeRecodes
a logical value; set to
TRUE
to return value labels that have been recoded in anedsurvey.data.frame
, alight.edsurvey.data.frame
, or anedsurvey.data.frame.list
. When set toFALSE
(the default), only the original value labels are included in the returneddata.frame
.
Value
a data.frame
that shows the variable names, variable labels, value labels,
value levels (if applicable), and the file format data source from an edsurvey.data.frame
, a light.edsurvey.data.frame
,
or an edsurvey.data.frame.list
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 both the student and school files, returning levels for variable values
showCodebook(data=sdf, fileFormat=c("student","school"), labelLevels = TRUE, includeRecodes = FALSE)
# return codebook information for the student file, excluding variable value levels,
# including recoded variables
sdf <- recode.sdf(sdf, recode = list(dsex = list(from = c("Male"), to = c("MALE"))))
showCodebook(data=sdf, fileFormat=c("student"), labelLevels = FALSE, includeRecodes = TRUE)
# return codebook information for the student file, including variable value levels
# and recoded variables
showCodebook(data=sdf, fileFormat=c("student","school"), labelLevels = FALSE, includeRecodes = TRUE)
# return codebook information for all codebooks in an edsurvey.data.frame; commonly use View()
View(showCodebook(data=sdf))
} # }