searchSDF {EdSurvey} | R Documentation |
EdSurvey Codebook Search
Description
Retrieves variable names and labels for an edsurvey.data.frame
,
a light.edsurvey.data.frame
, or an edsurvey.data.frame.list
using character string matching.
Usage
searchSDF(string, data, fileFormat = NULL, levels = FALSE)
Arguments
string |
a vector of character strings to search for in the database connection object ( |
data |
an |
fileFormat |
a character vector indicating the data source to search for variables.
The default |
levels |
a logical value; set to |
Value
a data.frame
that shows the variable names, labels,
and levels (if applicable) from an edsurvey.data.frame
or a light.edsurvey.data.frame
based on a matching character string
Author(s)
Michael Lee and Paul Bailey
Examples
## Not run:
# 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 by a character string
searchSDF(string="book", data=sdf)
# use the `|` (OR) operator to search several strings simultaneously
searchSDF(string="book|home|value", data=sdf)
# use a vector of strings to search for variables that contain multiple strings,
# such as both "book" and "home"
searchSDF(string=c("book","home"), data=sdf)
# search only the student files by a character string
searchSDF(string="algebra", data=sdf, fileFormat="student")
# search both the student and school files and return a glimpse of levels
searchSDF(string="value", data=sdf, levels=TRUE)
# save the search as an object to return a full data.frame of search
ddf <- searchSDF(string="value", data=sdf, levels=TRUE)
ddf
## End(Not run)